functionality added and bug fix