refactored templates into headers, mains into proper files