moved common to eval, added type for functions