Add reduce, sys_reduce, and polish up type system