Refactored controllers, other small fixes