use broader matching regex
trim directory name
fix callback issue and change parameter order
add tests
remove rifraf from dependencies