merging a couple of nested ifs
fixing an itemtype issue