added negative value handling