Added some console statement to try and understand where the issue is