refactor even more
refactor even more, fix some errors