Adding comments and fixing small issues