Added validation and belongs_to and has_many relations to model classes