Fixed some minor errors in the code