finsihing up refactor from previous commit