generalize input
optimize parse function for const char*