cleaned up architecture a bit