added typescript modules and class but there is still some optimizations needed