Refactored this stuff.