final testcases, fixes bugs, adds new template