Finished basic program, added error  checking.