minor changes, removed old stuff
Code reformatting
added support for newpagetemplate plugin

- inclusing some refactoring