Fixed test build error and pep8. Changed some template things.