added delete and refactored controllers