Simplified and cleaned up the code.