add extra documentation, fix bug in if statement