Solved some problems with trancation. need to debug further.