first restructure.
Add template system
Restructure, first runnable version.
fixes various bug.
pre-release merge