Some improvements and Theme improvements

-Started on a theme template and clean up of the theme system (too much
hardcoded php in the themes atm - not safe)
-Some other bugfixes and improvements