Added Main loops