refactored to rails 4 conventions