refactor into separate processes