works, but does not handle spaces in input