Added some code and added more console messages