Cleanup and add comments