rewrote handling of parsing functions