refactored controller, added callback