refactored reloading to make it reusable