now works with negative input