better implementation of require routines