consolidate and stream line some code before re-writing big chunks of it