Placed hide/show loading message into separate functions