threshold changed to Color.WHITE and Color.BLACK