More changes made to if-else part, yet to be tested