Fix some errors + add comments