Added loading message and fixed bug