Refactored finish_loading