Cleaned up code and refactored a few items into resources
Merged from remote