Replaced atoi with strtol