Full commented code and updated it to follow the correct code
conventions