Refactoring code calculator event