Fixed some stuff up and made it do threshold slicing