Refactored the execute method.