bookshelf script made conditional