Cleanup some code, refactoring options