More bug fixes and cleanup for controllers