just one bug left in refactor