Implemented loading spinner functionality