refactor source to the files and remove some templates