Pulled out the Parse logic so it can be used externally