cleanup, plus added funcmap support