Refactored perform task