Some operations reworked to be more memory friendly