Math.abs function used instead of an homebrewed implementation