#17 Corrected bugs in the code.