Cleanup and added comments