Introduce 'Term' type class, automatically lift functions, get rid of Any