Add cli options -i/-o for input/output files
Add -Wall flag and fix the warnings

Lot of functions were 'int somethin()', when should have been 'void something'.
Also there were couple of unused variables and functions declared after usage