Added reduce functional form, fixed integer subtraction bug