Fixed some bugs and added loading spinner.