refactored angular controller usage