totally unoptimized and bare bones first pass