Cleaned up code

simplified variables, templates and actual code files