Moving layout files

Moved the layout file to the app directory so that
multiple bundles may access it
Cleaning up Security controller

Cleaned up controller, refactoring some logic and adding in comments