refactored processing chain to allow more flexible routing