Added logging and test script