Updated atoi method