Added check for edge cases negative and zero