Motion correction

- Fixes in response to @philippe's review.
- Minor enhancements and refactorings