rewrote controllers and added functionality