refactored, so much better