First part of gui and database model