refactored spawn operations
code cleanup, fix all tests