Made necessary changes to make program working properly