Added controller functional. Updated application to use controller. Small fixes.