Added Earning and Earning Controller and turned Controller into a template class