Modified flatten to use pwd if no arguments passed