Modified the architecture a bit after discussion with codeninja.