using apply with vector syntax
added optimization
ignoring swp files
cleaned up, correctly buffering paths