Problem 2 commit

Added function prototypes for better top-down design
Added bounds checking for inputs