better handling negative numbers