Add comments, fix style issues