Refactor railtie.