converted a large portion of the main loops of SAlt