finish re-implementing *most* of the scalar ops