commenting the code as it had some errors