added implementation for define and require methods; added more specific tests for handling multiple define and require calls to check that define queuing works as expected in all cases.