Update permissions, fixed check order glitch.

Also re-organized code base for better forward scalability