refactor execute to fix more bugs in the system