Refactored code to make it cleaner
Enabled the user to get the actual resource when progress is done.
Added some extra comments