Refactor motion_processing