Added a toObj function to convert from string notation to an object