finish off refactor