refactoring rt.go code