Added a new function and some console logs