refactor: making tk code a bit more manageable