Fix for #18 and added newline at end of reverse output