refactor how it gets called