split long lines and replace an if with a when.
add optional and use it to implement float-parser