Read comments at the bottom of each code to understand what I did to find the error and what I found