inital refactor w/ bug