The basic template system with twigg, and some rewriting

did some main core