Update controller.js to resolve issue 45

Applied patch from tsimmons