Move render code into ts file.