Add comments, fix formatting