pulled out a function, refactored, took out logs, changed constants