Added console logs for debugging purposes.