Remove wrong condition for swap
Replace division with shift