Not much really, just some small stuff. Feel free to change if wrong.
Added an input text file for testing.