Fixed typo: atof -> atoi
Implemented tas_lgagst and some refactoring