Changed 'unsigned int' to 'int' (now comparison '< 0' makes sense).