got a general parse function working