rewrote most parts
clean up, restructured
added lnaguage support