Reducing dependency on numpy