Fixed potential bugs in input stream and set to exit on invalid option
Place operations inside seperate functions.
Implement options for more complex operations (TODO: implement the more complex operations)