Fixed main template. Added id generators for entities.