re-organized code with more services