reinstated original loops w/shifts, faster