If statements redone as ternary operators, properly implemented recur, read and write to file and lets as anonymous functions