implemented some unit tests
create temp directory automatically if required