Revert cbaabe5..375ae04

This rolls back to commit cbaabe5722e95a0f0d3cf7c4cafcb3f28b3456e6.
Cleaned up code