move to guard and some cleanup