Added new conditional in another nested condition and added two new functions.