Implement support for action timeout.
Remove unused code and imports.