Cleaned up architecture a bit.