Add comments and correct a couple of bugs