Refactor controllers and Services after conversion to Javascript