Fixing a bug, the output was just printed before instead of returned