String parsing optimizations

By being smarter about how we use string we reduce the instruction count
 (across the whole program) by around 20%
Add valgrind to the list of required packages