Fix project template, minor refactoring