Added some error checking

Signed-off-by: Rob Richard <robrichard87@gmail.com>
Completed Square

Signed-off-by: Rob Richard <robrichard87@gmail.com>