Implemented tas_lgagst and some refactoring