simplified Rail and changed data structure entirely