Added loading, fixing bugs with modal