Update main and refactored method