Fixes #2. However we do not always get a clean signal, so that this is still very much work-in-progress