That's okay as it is but good practice says that when it's possible to get an error you really should check for and handle it even if the handling is to stop the program.
I see wayyyyy too little error trapping in most of the code here, it's all written as if it's going to work right and be used right every time. By the time something wrong is noticed you might have a nice set of symptoms to have to fixing what ain't broke, a great way to add bugs to code. But that's not the worst. Worse is when the program doesn't appear to behave wrong and has people trusting bad output as good.
I'm only putting this out so the beginners can get an idea of why to trap errors without having to find out completely the hard way. Completely because no matter how you try not to, you will find ways to be wro---errrr---end up with bugs if you write much non-trivial code.