Added compound handling, fixed fundef cooperation with compounds.