Cleaned up the code a bit, fixed the dest dir name problem