move code into railtie