Local Ally and some clean

Implements local ally feature
Some clean has been made to remove some useless code