tidy up require logic