refactor like crazy