refactor to have a controller
refactor