Fix small issues and add comments