implemented magic number factory to refactor globals out.