fixed various bugs and added loading animation