add print/main funcs and correct bugs