[Tak] Improve coding style and fix minor bugs