add functions, fix result printing