copied more functions to rails mode