redesigned schema and refactored controller