not working - tried console logging variable values inside factory function