improve modularization of tateti program