Implemented to work with negative numbers