Algorithm seems to work, but still only debugging output