refactor, will do more refactor later