Cleans up deviation code