Cleanup and added comments.