Refactor and move tk part into a separate controller