reverted to Rails implementation