moved rails to script for initial run