Added some comments. Could not do it with lambda. Will try again another time