3-pointer version, still pretty hideous but safely handles cases with no spaces