improved bitshifting