explained the code