Controller function modified to be part of an angular module