refactor, fixed stuff