refactor nearly done