Use signed value to properly check whether there's a negative value
Remove unused variable
Make methods static that can be static

Also limits the input for the sscanf call explicitly in size.