Made exec a function call. Removed unused imports.