added loading logic and changed some stuff