Adding callback function

Added call function and base directory feature,
added test file to show how it works.