Changed _get_slacks_needed()

changed _get_slacks_needed() to be faster, shorter and correct.