basically correct, negative values still need work