Updated allowEmpty and added tests