Added the cleaned up code.