First completed all-in-one template file with supporting functions.