updated structure using definitions and cleaned up templates