Cleanup and organize code.