Cleaned up, refactored