Add more unit tests and seperate out.  More error checking around parsing.