Fixed bug causing slug to mutate input. Still optimized.