adding error handling
Tightening up the rails engine