Corrected the errors

Working code