Updated controller to pep8 standards

Also more cleanup of the embedded flag function.