made helper function for auto-reloging to condense code