refactored controller, added details page and func