Refactored code. Clean up.