complete overhaul, rewrote from scratch