made code more generic to suit any binary classification task