added top-level fn parsing