Updated loading class to be more flexible.