mostly finished the code now i think

only minor change /should/ be needed now