got rid of Number.maxsafeinteger as safari does not like it