moving more logic into the 'ng' global