added functions to make scripts completely idependent (don't require smallbox)