Fixed handling of trailing path separators
Added -n option, and generalised option passing.
Added polling support.