major refactor!