input/ouput pretty much done, needs testing