updates to contrast algorithm to make sure converts working properly