refactored to use controllers