diff --git a/app/build.gradle b/app/build.gradle
index 1a654f4061e1f6f7f48c3923205ade8a58583575..4aaf4ac42f30cd63f1741a0bb72a51f16197a2fa 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
 
 android {
     compileSdkVersion 28
-    buildToolsVersion '27.0.3'
+    buildToolsVersion '28.0.3'
     defaultConfig {
         applicationId "com.uos.admin.sleepbetter"
         minSdkVersion 18
@@ -22,6 +22,7 @@ android {
         checkReleaseBuilds false
 
     }
+    useLibrary 'org.apache.http.legacy'
 }
 
 dependencies {
@@ -38,12 +39,11 @@ dependencies {
     androidTestImplementation 'com.android.support.test:runner:1.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     implementation 'com.android.support:design:28.0.0-alpha1'
-
     implementation 'android.arch.persistence.room:runtime:1.0.0'
     annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
-
     implementation 'com.sun.mail:android-mail:1.6.0'
     implementation 'com.sun.mail:android-activation:1.6.0'
-
-
+    implementation files('/Users/admin/Documents/Jobs/Research/Sleep/SleepBetterAndroid/libs/apache-mime4j-0.6.1.jar')
+    implementation files('/Users/admin/Documents/Jobs/Research/Sleep/SleepBetterAndroid/libs/httpmime-4.0.1.jar')
+    implementation 'com.android.volley:volley:1.1.0'
 }
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index afacbf838ec1cd959c8c6420af39f7683b58e2a9..388b8487f6e451a961e6f31d7bfb13fbad4b014f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -10,6 +10,7 @@
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
     <uses-permission android:name="android.permission.NEW_OUTGOING_CALL" />
 
+
     <application
 
         android:allowBackup="true"
@@ -29,6 +30,8 @@
         <activity android:name=".FirstPageConsent" />
 
         <receiver android:name=".QuestionnaireBroadcast" />
+        <receiver android:name=".QuestionnaireBroadcastTwo" />
+        <receiver android:name=".QuestionnaireBroadcastThree" />
         <receiver android:name=".ExperimentBroadcast" />
 
         <activity
@@ -40,7 +43,23 @@
         <activity android:name=".Notice"></activity>
         <activity android:name=".QInitial"></activity>
         <activity android:name=".Demographics"></activity>
+        <activity android:name=".Settings"></activity>
+        <activity android:name=".MyCurrentExperiment"></activity>
+        <activity android:name=".Update_Light_Bright"></activity>
+        <activity android:name=".Update_Light_Glasses"></activity>
+        <activity android:name=".Update_Light_TurnOffBright"></activity>
+        <activity android:name=".Update_Caffeine_Empty"></activity>
+        <activity android:name=".Update_Caffeine_limit"></activity>
+        <activity android:name=".Update_Caffeine_6hours"></activity>
+        <activity android:name=".Update_Schedule_Relax"></activity>
+        <activity android:name=".Update_Schedule_7hours"></activity>
+        <activity android:name=".Update_Schedule_Midnight"></activity>
+        <activity android:name=".Update_Schedule_SameTime"></activity>
+        <activity android:name=".QFinal"></activity>
 
+        <uses-library
+            android:name="org.apache.http.legacy"
+            android:required="false" />
     </application>
 
 </manifest>
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/AllPages.java b/app/src/main/java/com/uos/admin/sleepbetter/AllPages.java
index c369e9f907393eb07ffea8b529747b6216da85b0..d836f7c481e16074f780d73cf948fee1cf57e0f4 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/AllPages.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/AllPages.java
@@ -1,6 +1,7 @@
 package com.uos.admin.sleepbetter;
 
 
+import android.app.ActionBar;
 import android.app.AlarmManager;
 import android.app.FragmentManager;
 import android.app.FragmentTransaction;
@@ -14,8 +15,11 @@ import android.content.Intent;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.SystemClock;
+import android.support.annotation.RequiresApi;
 import android.support.design.widget.TabLayout;
 import android.support.v4.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.content.LocalBroadcastManager;
 import android.support.v4.view.ViewPager;
 import android.view.View;
 import android.support.design.widget.NavigationView;
@@ -26,6 +30,8 @@ import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
 import android.view.MenuItem;
 import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
 import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.TextView;
@@ -43,9 +49,10 @@ public class AllPages extends AppCompatActivity {
 
 
     Toolbar toolbar;
-    TabLayout tabLayout;
+    public static TabLayout tabLayout;
     ViewPager viewPager;
 
+    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -81,7 +88,24 @@ public class AllPages extends AppCompatActivity {
         tabLayout.getTabAt(4).setIcon(R.drawable.calendar);
         tabLayout.getTabAt(5).setIcon(R.drawable.pen);
 
-    }
 
+        Window window = this.getWindow();
+
+// clear FLAG_TRANSLUCENT_STATUS flag:
+        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
 
+// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
+        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+
+// finally change the color
+        window.setStatusBarColor(ContextCompat.getColor(this,R.color.colorPrimaryDark));
+    }
+
+    @Override
+    public void onBackPressed() {
+        Intent a = new Intent(Intent.ACTION_MAIN);
+        a.addCategory(Intent.CATEGORY_HOME);
+        a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        startActivity(a);
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/CalendarPage.java b/app/src/main/java/com/uos/admin/sleepbetter/CalendarPage.java
index 9716ecc683246d579fb913decfb4cb002a9a7644..24537749ee884628f8bd1ff433f9dbfd790981ca 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/CalendarPage.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/CalendarPage.java
@@ -1,10 +1,16 @@
 package com.uos.admin.sleepbetter;
 
+import android.app.AlertDialog;
+import android.app.Dialog;
 import android.app.FragmentTransaction;
 import android.arch.persistence.room.Room;
+import android.content.DialogInterface;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -24,34 +30,58 @@ import java.util.Date;
 import java.util.GregorianCalendar;
 
 import static android.content.Context.MODE_PRIVATE;
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 public class CalendarPage extends Fragment {
     public GregorianCalendar cal_month, cal_month_copy;
     private HwAdapter hwAdapter;
     private TextView tv_month;
     View helpView;
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         helpView = inflater.inflate(R.layout.act_calendar, container, false);
 
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() == null && tabLayout.getSelectedTabPosition() == 4) {
+            loadPageDataProcessing();
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("calendar", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("calendar", false).apply();
+
+            }
+        }
+        TextView cons8 = helpView.findViewById(R.id.factorsIntro);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
 
         return helpView;
     }
 
-    private boolean isViewShown = false;
-
     @Override
     public void setUserVisibleHint(boolean isVisibleToUser) {
         super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 4) {
             loadPageDataProcessing();
-        } else {
-            isViewShown = false;
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("calendar", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("calendar", false).apply();
+
+            }
         }
+
+
     }
 
+
     public void loadPageDataProcessing() {
 
         Date c = Calendar.getInstance().getTime();
@@ -80,6 +110,20 @@ public class CalendarPage extends Fragment {
 
         int shouldBe = c1.get(Calendar.DAY_OF_YEAR) - c2.get(Calendar.DAY_OF_YEAR);
 
+//adding a new day only after the ques limit - e.g. after 4 am
+        Calendar calendar1 = Calendar.getInstance();
+        SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm");
+        String currentHour = formatter1.format(calendar1.getTime());
+
+        String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        String[] currentHourComponents = currentHour.split(":");
+
+        if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
+            shouldBe--;
+        }
+
 
         HomeCollection.date_collection_arr = new ArrayList<HomeCollection>();
 
@@ -176,6 +220,11 @@ public class CalendarPage extends Fragment {
     public void onResume() {
         super.onResume();
 
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (tabLayout.getSelectedTabPosition() == 4){
+            loadPageDataProcessing();
+        }
+
         Date c = Calendar.getInstance().getTime();
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String currentDate = df.format(c);
@@ -219,6 +268,23 @@ public class CalendarPage extends Fragment {
         String dayForLoop = startingDate;
         Calendar cal = Calendar.getInstance();
 
+        boolean afterQuesLimit = false;
+
+        Calendar calendar1 = Calendar.getInstance();
+        SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm");
+        String currentHour = formatter1.format(calendar1.getTime());
+
+        String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        String[] currentHourComponents = currentHour.split(":");
+
+
+        afterQuesLimit = (Integer.valueOf(currentHourComponents[0]) < 19 && Integer.valueOf(currentHourComponents[0]) > Integer.valueOf(lastQuestNotifComponents[0])) || (Integer.valueOf(currentHourComponents[0]) == Integer.valueOf(lastQuestNotifComponents[0]) && Integer.valueOf(currentHourComponents[1]) > Integer.valueOf(lastQuestNotifComponents[1]));
+
+
+
+
         for (int i = 0; i <= shouldBe - 1; i++) {
             Date d1 = null;
             try {
@@ -230,7 +296,12 @@ public class CalendarPage extends Fragment {
 
             String dateToAdd = changer.format(d1);
 
-            HomeCollection.date_collection_arr.add(new HomeCollection(dateToAdd, experimentsArray[i], moods[i], diaries[i]));
+            if (!(i == shouldBe - 1)) {
+                HomeCollection.date_collection_arr.add(new HomeCollection(dateToAdd, experimentsArray[i], moods[i], diaries[i]));
+            }
+            if (i == shouldBe - 1 && afterQuesLimit) {
+                HomeCollection.date_collection_arr.add(new HomeCollection(dateToAdd, experimentsArray[i], moods[i], diaries[i]));
+            }
 
 
             try {
@@ -318,5 +389,30 @@ public class CalendarPage extends Fragment {
         tv_month.setText(android.text.format.DateFormat.format("MMMM yyyy", cal_month));
     }
 
+    public static class InfoFirstDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("This section would present your data classified by days. You could only see the progress from previous days - they will be highlighted on the calendar. Data will show you the experiment you had for that day, the comments you put into the Goal Diary, and how you felt compared to the previous day.");
+
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
 
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Data.java b/app/src/main/java/com/uos/admin/sleepbetter/Data.java
index 19d0a845841b23a4faa539dea29265344ce2e4bd..4c861bbeba9b61b212c098d58159adc334f8f686 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Data.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Data.java
@@ -7,9 +7,12 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.SharedPreferences;
 import android.graphics.Color;
+import android.os.Build;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.design.widget.TabLayout;
 import android.support.v4.app.Fragment;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -29,17 +32,34 @@ import java.util.Iterator;
 import java.util.List;
 import android.support.v4.app.DialogFragment;
 
+import static android.content.Context.MODE_PRIVATE;
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
+
 public class Data extends Fragment implements AdapterView.OnItemSelectedListener {
     private UserDatabase userDatabase;
     private static final String DATABASE_NAME = "user_db";
     private Spinner spinner;
     View dataView;
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         dataView = inflater.inflate(R.layout.act_data, container, false);
 
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() == null && tabLayout.getSelectedTabPosition() == 2) {
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("data", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("data", false).apply();
+
+            }
+        }
+
         Button info1 = (Button) dataView.findViewById(R.id.infoRatings);
         info1.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
@@ -70,24 +90,13 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
             }
         });
 
-        return dataView;
-    }
+        TextView cons8 = dataView.findViewById(R.id.dataIntro);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
 
+        updateAllTexts();
 
-    private boolean isViewShown = false;
+        //from load function
 
-    @Override
-    public void setUserVisibleHint(boolean isVisibleToUser) {
-        super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
-            loadPageDataProcessing();
-        } else {
-            isViewShown = false;
-        }
-    }
-
-    public void loadPageDataProcessing() {
 
 
         new Thread(new Runnable() {
@@ -157,7 +166,6 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
 
                     int sizeOfSecondGraph = 0;
 
-                    System.out.println("nr" + numberOfGoodMoods.size());
                     int beginning;
                     if ((numberOfGoodMoods.size() -1) % 5 == 0){
                         beginning = numberOfGoodMoods.size() - 5;
@@ -243,7 +251,7 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
 
         }).start();
 
-        updateAllTexts();
+
 
         spinner = (Spinner) dataView.findViewById(R.id.spinner);
         ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity().getApplicationContext(),
@@ -253,10 +261,9 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
         spinner.setAdapter(adapter);
         spinner.setOnItemSelectedListener(this);
 
+        return dataView;
     }
 
-
-
     private int sizeOfMoods(ArrayList<Double> integers) {
 
         int size = 0;
@@ -269,6 +276,25 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
         return size;
     }
 
+    @Override
+    public void setUserVisibleHint(boolean isVisibleToUser) {
+        super.setUserVisibleHint(isVisibleToUser);
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 2) {
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("data", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("data", false).apply();
+
+            }
+        }
+
+
+
+    }
     private void updateAllTexts() {
         TextView editWorking = (TextView) dataView.findViewById(R.id.workEdit);
         String result = "Nothing to work on";
@@ -460,7 +486,7 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
         @Override
         public Dialog onCreateDialog(Bundle savedInstanceState) {
             AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-            builder.setMessage("For this graph you are able to choose which attribute's progress you want to view during the time you used SleepBetter. \\\"Lower is better\\\" means a lower value is desirable, as it shows a better, improved state.");
+            builder.setMessage("For this graph you are able to choose which attribute's progress you want to view during the time you used SleepBetter. \"Lower is better\" means a lower value is desirable, as it shows a better, improved state.");
             builder.setNegativeButton("OK", new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int id) {
                     dialog.dismiss();
@@ -470,6 +496,32 @@ public class Data extends Fragment implements AdapterView.OnItemSelectedListener
         }
     }
 
+    public static class InfoFirstDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("In this section you will be able to look at the data gathered from filling in the daily questionnaire. You can look at your last day's status (or last completed questionnaire).You can also see the attributes/points rated in the daily questionnaire that could be improved in the future (by following the guidelines in the app). Moreover, you can see 3 graphs with your progress in time, based on your overall mood (an average of all your answers to the questionnaire) and other attributes. \"Lower is better\" means that a lower number shows a better/healthier state for you. For example, taking 0-15 minutes to fall asleep once you get into bed (the first option in question 1) would be regarded as \"1\". If at some point, you didn't complete the daily questionnaire, the experiment goes on, but some of the values from this page will show \"-1\" for the day.");
+
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
+
     @Override
     public void onNothingSelected(AdapterView<?> adapterView) {
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Demographics.java b/app/src/main/java/com/uos/admin/sleepbetter/Demographics.java
index 9129f0ed21da44ee4c899436278a50dcd500374f..e463ecc8abe41fbb8d9fb8620a3faf933e913e8c 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Demographics.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Demographics.java
@@ -1,15 +1,21 @@
 package com.uos.admin.sleepbetter;
 
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Button;
 import android.widget.RadioGroup;
+import android.widget.TextView;
+
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 public class Demographics extends AppCompatActivity {
 
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.act_demograpics);
@@ -26,6 +32,9 @@ public class Demographics extends AppCompatActivity {
 
         });
 
+        TextView cons8 = findViewById(R.id.firstSet);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
     }
 
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/ExperimentBroadcast.java b/app/src/main/java/com/uos/admin/sleepbetter/ExperimentBroadcast.java
index f0b29c473f6d256e460366bbba47469a77d18285..cd63f156fa1fe7829938f81e297b2d7d8c51e384 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/ExperimentBroadcast.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/ExperimentBroadcast.java
@@ -35,7 +35,7 @@ public class ExperimentBroadcast extends BroadcastReceiver {
                             .bigText(messageM))
                     .setContentText(messageM)
                     .setAutoCancel(false).setWhen(when)
-                    .setOngoing(true)
+                    .setOngoing(false)
                     .setContentIntent(pendingIntent);
             notificationManager.notify(13, mNotifyBuilder.build());
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Factors.java b/app/src/main/java/com/uos/admin/sleepbetter/Factors.java
index 384d03049bcc6f9220881a85019007230dd7b73f..2c1e600a3a602ef76b1cc12d450cb4370f5f2bbe 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Factors.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Factors.java
@@ -7,19 +7,27 @@ import android.app.NotificationChannel;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.arch.persistence.room.Room;
+import android.content.BroadcastReceiver;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.design.widget.TabLayout;
 import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
+import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import java.text.ParseException;
@@ -30,6 +38,7 @@ import java.util.Calendar;
 import java.util.Date;
 
 import static android.content.Context.MODE_PRIVATE;
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 
 public class Factors extends Fragment {
@@ -38,85 +47,117 @@ public class Factors extends Fragment {
 
     private static RadioGroup radioGroup;
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         factorsView = inflater.inflate(R.layout.act_experiments, container, false);
 
-        Button button2 = (Button) factorsView.findViewById(R.id.submit);
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() == null && tabLayout.getSelectedTabPosition() == 1) {
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("experiments", true) == true) {
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("experiments", false).apply();
+
+            }
+
+        }
+
+       Button button2 = (Button) factorsView.findViewById(R.id.submit);
         button2.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 submitExperiment();
             }
         });
 
+        TextView cons8 = factorsView.findViewById(R.id.factorsIntro);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
         return factorsView;
     }
 
-
-    private boolean isViewShown = false;
-
     @Override
     public void setUserVisibleHint(boolean isVisibleToUser) {
         super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 1) {
             loadPageDataProcessing();
-        } else {
-            isViewShown = false;
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("experiments", true) == true) {
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("experiments", false).apply();
+
+            }
+
         }
+
+
     }
 
-    public void loadPageDataProcessing(){
+    @Override
+    public void onResume() {
+        super.onResume();
 
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (tabLayout.getSelectedTabPosition() == 1) {
+            loadPageDataProcessing();
+        }
+    }
 
 
+    public void loadPageDataProcessing() {
         String experiment = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("experiment", "nothing");
         int savedRadioIndex = getActivity().getApplicationContext().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).getInt("KEY_SAVED_RADIO_BUTTON_INDEX", 0);
 
         radioGroup = (RadioGroup) factorsView.findViewById(R.id.experimentsGroup);
 
-        if (!experiment.equals("nothing")){
-            RadioButton savedCheckedRadioButton = (RadioButton)radioGroup.getChildAt(savedRadioIndex);
+        if (!experiment.equals("nothing")) {
+            RadioButton savedCheckedRadioButton = (RadioButton) radioGroup.getChildAt(savedRadioIndex);
             savedCheckedRadioButton.setChecked(true);
         }
 
-        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
-        {
+        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(RadioGroup group, int checkedId) {
 
                 int checkedIndex;
 
-                RadioButton rb =(RadioButton) factorsView.findViewById(checkedId);
-                if (rb.getText().equals(getString(R.string.firstLight))){
+                RadioButton rb = (RadioButton) factorsView.findViewById(checkedId);
+                if (rb.getText().equals(getString(R.string.firstLight))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.firstLight)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 1).apply();
-                } else if (rb.getText().equals(getString(R.string.secondLight))){
+                } else if (rb.getText().equals(getString(R.string.secondLight))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.secondLight)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 2).apply();
-                } else if (rb.getText().equals(getString(R.string.thirdLight))){
+                } else if (rb.getText().equals(getString(R.string.thirdLight))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.thirdLight)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 3).apply();
-                } else if (rb.getText().equals(getString(R.string.firstCaffeine))){
+                } else if (rb.getText().equals(getString(R.string.firstCaffeine))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.firstCaffeine)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 5).apply();
-                } else if (rb.getText().equals(getString(R.string.secondCaffeine))){
+                } else if (rb.getText().equals(getString(R.string.secondCaffeine))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.secondCaffeine)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 6).apply();
-                } else if (rb.getText().equals(getString(R.string.thirdCaffeine))){
+                } else if (rb.getText().equals(getString(R.string.thirdCaffeine))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.thirdCaffeine)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 7).apply();
-                } else if (rb.getText().equals(getString(R.string.firstSchedule))){
+                } else if (rb.getText().equals(getString(R.string.firstSchedule))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.firstSchedule)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 9).apply();
-                } else if (rb.getText().equals(getString(R.string.secondSchedule))){
+                } else if (rb.getText().equals(getString(R.string.secondSchedule))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.secondSchedule)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 10).apply();
-                } else if (rb.getText().equals(getString(R.string.thirdSchedule))){
+                } else if (rb.getText().equals(getString(R.string.thirdSchedule))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.thirdSchedule)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 11).apply();
-                } else if (rb.getText().equals(getString(R.string.fourthSchedule))){
+                } else if (rb.getText().equals(getString(R.string.fourthSchedule))) {
                     getActivity().getSharedPreferences("name", MODE_PRIVATE).edit().putString("experiment", getString(R.string.fourthSchedule)).apply();
                     getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt("KEY_SAVED_RADIO_BUTTON_INDEX", 12).apply();
                 }
@@ -124,7 +165,6 @@ public class Factors extends Fragment {
         });
 
 
-
         Date c = Calendar.getInstance().getTime();
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String currentDate = df.format(c);
@@ -145,7 +185,7 @@ public class Factors extends Fragment {
 
         SimpleDateFormat dates = new SimpleDateFormat("dd-MMM-yyyy");
 
-        if (previousExperimentStartDate.equals("")){
+        if (previousExperimentStartDate.equals("")) {
             previousExperimentStartDate = currentDate;
         }
         //Setting dates
@@ -164,49 +204,53 @@ public class Factors extends Fragment {
 
         int differenceBetweenOldExperimentAndCurrent = c1.get(Calendar.DAY_OF_YEAR) - c2.get(Calendar.DAY_OF_YEAR);
 
+        //adding a new day only after the ques limit - e.g. after 4 am
+        Calendar calendarr = Calendar.getInstance();
+        SimpleDateFormat formatterr = new SimpleDateFormat("HH:mm");
+        String currentHourr = formatterr.format(calendarr.getTime());
 
-        if (differenceBetweenOldExperimentAndCurrent % 5 != 0){
+        String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        String[] currentHourComponents = currentHourr.split(":");
+        if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
+            differenceBetweenOldExperimentAndCurrent--;
+        }
+
+
+        System.out.println(loggedIn);
+        if (differenceBetweenOldExperimentAndCurrent % 5 != 0) {
             for (int i = 0; i < radioGroup.getChildCount(); i++) {
                 radioGroup.getChildAt(i).setEnabled(false);
             }
             Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment as 5 days have not passed yet.", Toast.LENGTH_LONG).show();
 
 
-            } else if (differenceBetweenOldExperimentAndCurrent == 0 && getActivity().getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "").equals("newPicked")){
+        } else if (differenceBetweenOldExperimentAndCurrent == 0 && getActivity().getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "").equals("newPicked")) {
 
+            for (int i = 0; i < radioGroup.getChildCount(); i++) {
+                radioGroup.getChildAt(i).setEnabled(false);
+            }
+            Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment yet as you've just picked it.", Toast.LENGTH_LONG).show();
+
+        } else if (differenceBetweenOldExperimentAndCurrent % 5 == 0 && differenceBetweenOldExperimentAndCurrent != 0) {
+            if (loggedIn % 5 != 1) {
                 for (int i = 0; i < radioGroup.getChildCount(); i++) {
                     radioGroup.getChildAt(i).setEnabled(false);
                 }
-                Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment yet as you've just picked it.", Toast.LENGTH_LONG).show();
-
-            } else if (differenceBetweenOldExperimentAndCurrent % 5 == 0 && differenceBetweenOldExperimentAndCurrent != 0) {
-    if (Integer.valueOf(currentHour) < 19) {
-        System.out.println("correct 5");
-        for (int i = 0; i < radioGroup.getChildCount(); i++) {
-            radioGroup.getChildAt(i).setEnabled(false);
-        }
-        Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment yet. You can change it after 19:00 today.", Toast.LENGTH_LONG).show();
+                Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment yet. You can change it after completing today's questionnaire.", Toast.LENGTH_LONG).show();
 
-    } else if (loggedIn % 5 != 1) {
-        System.out.println("correct 6");
-        for (int i = 0; i < radioGroup.getChildCount(); i++) {
-            radioGroup.getChildAt(i).setEnabled(false);
+            }
         }
-        Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you can't change your experiment yet. You can change it after completing today's questionnaire.", Toast.LENGTH_LONG).show();
-
-    }
-}
-
-
 
 
     }
 
-    private void SavePreferences(String key, int value){
+    private void SavePreferences(String key, int value) {
         getActivity().getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE).edit().putInt(key, value).apply();
     }
 
-    private void submitExperiment(){
+    private void submitExperiment() {
 
         FactorsDialog dia = new FactorsDialog();
         dia.show(getFragmentManager(), "dialog");
@@ -236,19 +280,19 @@ public class Factors extends Fragment {
                     break;
                 case 2: //wear glasses that block blue light during the night
                     builder.setMessage("Are you sure you want to choose this experiment? You will not be able to change it for the next 5 days. This experiment presumes:\nMaybe installing the f.lx app fromm google that warms up your computer display at night, to match your indoor lighting;\nIf needed - wearing glasses/a sleeping mask to block blue light during the night.");
-                    message = "\"Use the \\\"f.lux\\\" app!\"!";
+                    message = "\"Use the \\\"f.lux\\\" app!\" and wear a sleeping mask/glasses when going to sleep!";
                     hour = 12;
                     minute = 30;
                     break;
                 case 3: // turn off any bright lights 2 hours before going to bed
                     builder.setMessage("Are you sure you want to choose this experiment? You will not be able to change it for the next 5 days. This experiment presumes:\nTurning off the TV/computer with 2 hours before going to bed;\nTurning off any other bright lights in your room with 2 hours before going to bed.");
-                    message = "Going to bed soon?\", \"Do not forget to turn off your light with 2 hours before bed!";
+                    message = "Going to bed soon?, Do not forget to turn off your light with 2 hours before bed!";
                     hour = 19;
                     minute = 30;
                     break;
                 case 5: // Do not drink caffeine within 6 hours
                     builder.setMessage("Are you sure you want to choose this experiment? You will not be able to change it for the next 5 days. This experiment presumes:\nNot drinking coffee/soda/any energy drink with 6 hours before sleep.");
-                    message = "Going to bed soon?\", \"Do not forget to turn off your light with 2 hours before bed!";
+                    message = "Don't drink caffeine within 6 hours of going to bed!!";
                     hour = 19;
                     minute = 30;
                     break;
@@ -293,39 +337,71 @@ public class Factors extends Fragment {
 
 
             builder.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
-                        public void onClick(DialogInterface dialog, int id) {
-                             //daca nu e blocat, atunci se updateaza experimentul, se blocheaza accesul si se incrementeaza nr de zile
-                                for (int i = 0; i < radioGroup.getChildCount(); i++) {
-                                    radioGroup.getChildAt(i).setEnabled(false);
-                                }
+                public void onClick(DialogInterface dialog, int id) {
+                    //daca nu e blocat, atunci se updateaza experimentul, se blocheaza accesul si se incrementeaza nr de zile
+                    for (int i = 0; i < radioGroup.getChildCount(); i++) {
+                        radioGroup.getChildAt(i).setEnabled(false);
+                    }
 
 
-                                //update starting date
-                                Date c = Calendar.getInstance().getTime();
-                                SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
-                                final String currentDate = df.format(c);
 
-                                getActivity().getSharedPreferences("date", MODE_PRIVATE).getString("startExperiment", "");
-                                getActivity().getSharedPreferences("date", MODE_PRIVATE).edit().putString("startExperiment", currentDate).apply();
-                                getActivity().getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "newPicked");
-                                getActivity().getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "newPicked").apply();
 
-                            //
+                    getActivity().getSharedPreferences("date", MODE_PRIVATE).getString("startExperiment", "");
 
+                    //adding a new day only after the ques limit - e.g. after 4 am
+                    Calendar calendarr = Calendar.getInstance();
+                    SimpleDateFormat formatterr = new SimpleDateFormat("HH:mm");
+                    String currentHourr = formatterr.format(calendarr.getTime());
 
-                            String participantID = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
+                    String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+                    String[] lastQuestNotifComponents = quesLimit.split(":");
 
-                            Intent intent = new Intent(getActivity().getApplicationContext(), AllPages.class);
+                    String[] currentHourComponents = currentHourr.split(":");
 
-                                startActivity(intent);
+                    if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
 
-                            createQuestionnaireNotification();
-                            createExperimentNotification();
+                        Date dt = Calendar.getInstance().getTime();
+                        Calendar cal = Calendar.getInstance();
+                        cal.setTime(dt);
+                        cal.add(Calendar.DATE, -1);
+                        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
+                        final String currentDate = dateFormat.format(cal.getTime());
 
+                        getActivity().getSharedPreferences("date", MODE_PRIVATE).edit().putString("startExperiment", currentDate).apply();
 
+                        System.out.println(currentDate);
+                    } else {
 
-                        }
-                    })
+                        //update starting date
+
+                        Date c = Calendar.getInstance().getTime();
+                        SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
+                        final String currentDate = df.format(c);
+                        getActivity().getSharedPreferences("date", MODE_PRIVATE).edit().putString("startExperiment", currentDate).apply();
+
+                        System.out.println(currentDate);
+
+                    }
+
+
+                    getActivity().getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "newPicked");
+                    getActivity().getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "newPicked").apply();
+
+                    //
+
+
+                    String participantID = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
+
+                    Intent intent = new Intent(getActivity().getApplicationContext(), AllPages.class);
+
+                    startActivity(intent);
+
+                    createQuestionnaireNotification();
+                    createExperimentNotification();
+
+
+                }
+            })
                     .setNegativeButton("Back", new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int id) {
                             // User cancelled the dialog
@@ -352,7 +428,7 @@ public class Factors extends Fragment {
 
             Calendar calendar = Calendar.getInstance();
             calendar.set(Calendar.HOUR_OF_DAY, 19);
-            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.MINUTE, 55);
             calendar.set(Calendar.SECOND, 0);
 
             if (Calendar.getInstance().after(calendar)) {
@@ -366,9 +442,11 @@ public class Factors extends Fragment {
 
         private void createExperimentNotification() {
 
+            getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putString("currentNot", hour + ":" + minute).apply();
+
             Calendar calendar = Calendar.getInstance();
-            calendar.set(Calendar.HOUR_OF_DAY, hour);
-            calendar.set(Calendar.MINUTE, minute);
+            calendar.set(Calendar.HOUR_OF_DAY, 19);
+            calendar.set(Calendar.MINUTE, 56);
             calendar.set(Calendar.SECOND, 0);
 
             if (Calendar.getInstance().after(calendar)) {
@@ -383,4 +461,28 @@ public class Factors extends Fragment {
     }
 
 
+    public static class InfoFirstDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("This is where you will be able to choose your preferred experiment to try out for the next 5 days in order to improve your sleep. Please bare in mind that once you choose an experiment, you cannot change it for the next 5 days. When clicking submit, a dialog will pop up outlining the experiment information again and asking you if you are sure about your choice. Also, once 5 days have passed, you will be able to change the experiment after completing that day's questionnaire. If you won't change the experiment, your current one will continue for another 5 days.");
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/FirstPage.java b/app/src/main/java/com/uos/admin/sleepbetter/FirstPage.java
index 9664c955814dee30bc1c565e2965eb1f92934c1d..e376026ca6f77251b755af32242dffdfeb751433 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/FirstPage.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/FirstPage.java
@@ -131,7 +131,6 @@ public class FirstPage extends AppCompatActivity {
 
                 getSharedPreferences("name", MODE_PRIVATE).edit().putString("username", name).apply();
                 getSharedPreferences("name", MODE_PRIVATE).edit().putString("participantID", participant).apply();
-                getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit().putBoolean("isFirstRun", false).apply();
 
                 startActivity(intent);
 
@@ -139,4 +138,5 @@ public class FirstPage extends AppCompatActivity {
 
     }
 
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/FirstPageConsent.java b/app/src/main/java/com/uos/admin/sleepbetter/FirstPageConsent.java
index 405fb00a3418e925711536b39ee018c8c0350eff..fe05498918024b1b9751a8e3bcdf73d009d288f6 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/FirstPageConsent.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/FirstPageConsent.java
@@ -1,17 +1,23 @@
 package com.uos.admin.sleepbetter;
 
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
+import android.widget.TextView;
 import android.widget.Toast;
 
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
+
 public class FirstPageConsent extends AppCompatActivity {
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -29,6 +35,25 @@ public class FirstPageConsent extends AppCompatActivity {
 
         });
 
+        TextView descr = findViewById(R.id.factorsIntro);
+        descr.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView cons1 = findViewById(R.id.p1);
+        cons1.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons2 = findViewById(R.id.p2);
+        cons2.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons3 = findViewById(R.id.p3);
+        cons3.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons4 = findViewById(R.id.p4);
+        cons4.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons5 = findViewById(R.id.p5);
+        cons5.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons6 = findViewById(R.id.p6);
+        cons6.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons7 = findViewById(R.id.p7);
+        cons7.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView cons8 = findViewById(R.id.p8);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
     }
     private void goBack() {
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/GoalDiary.java b/app/src/main/java/com/uos/admin/sleepbetter/GoalDiary.java
index ab0caff53fb57a6ee51fa8c33fab9b25f4d89e35..8fe36fa259612919c884dfa347ace1a198b39c13 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/GoalDiary.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/GoalDiary.java
@@ -1,13 +1,24 @@
 package com.uos.admin.sleepbetter;
 
+import android.app.AlertDialog;
+import android.app.Dialog;
 import android.arch.persistence.room.Room;
+import android.content.Context;
+import android.content.DialogInterface;
 import android.graphics.Color;
+import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ImageView;
@@ -24,6 +35,7 @@ import java.util.Date;
 import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 public class GoalDiary extends Fragment {
 
@@ -32,11 +44,27 @@ public class GoalDiary extends Fragment {
     private UserDatabase userDatabase;
     private String note;
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         goalDiaryView = inflater.inflate(R.layout.act_diary, container, false);
 
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() == null && tabLayout.getSelectedTabPosition() == 3) {
+
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("diary", true)){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("diary", false).apply();
+
+            }
+        }
+
+
+
         Button button = (Button) goalDiaryView.findViewById(R.id.button);
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -46,28 +74,21 @@ public class GoalDiary extends Fragment {
                 note = noted.getText().toString();
                 if (!note.equals("")) {
                     updateDiary(note);
-                }
-            }
 
-        });
+                    InputMethodManager inputManager = (InputMethodManager)
+                            getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
 
-        return goalDiaryView;
-    }
+                    inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
+                            InputMethodManager.HIDE_NOT_ALWAYS);
 
-    private boolean isViewShown = false;
+                    noted.setText("");
+                }
+            }
 
-    @Override
-    public void setUserVisibleHint(boolean isVisibleToUser) {
-        super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
-            loadPageDataProcessing();
-        } else {
-            isViewShown = false;
-        }
-    }
+        });
 
-    public void loadPageDataProcessing() {
+        TextView cons8 = goalDiaryView.findViewById(R.id.pleaseInput);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
 
         new Thread(new Runnable() {
             @Override
@@ -106,7 +127,31 @@ public class GoalDiary extends Fragment {
 
             }
         }).start();
+
+        return goalDiaryView;
     }
+
+
+    @Override
+    public void setUserVisibleHint(boolean isVisibleToUser) {
+        super.setUserVisibleHint(isVisibleToUser);
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 3) {
+
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("diary", true)){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("diary", false).apply();
+
+            }
+        }
+
+
+    }
+
     public void updateDiary(String notee) {
 
         Date c = Calendar.getInstance().getTime();
@@ -186,4 +231,30 @@ public class GoalDiary extends Fragment {
         }).start();
 
     }
+
+    public static class InfoFirstDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("This section is where you can save any notes, insights, comments or ideas about your experience - think of it as a notebook that would help you record any comments. Also, you will be able to see previous comments from the current day only. The old ones could only be seen in the Calendar section.");
+
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Menu.java b/app/src/main/java/com/uos/admin/sleepbetter/Menu.java
index 08a5f0eb3d1816e5fce32eb6a09837241c858a84..466e5435acc1b67f564538213a4e82423edd33b9 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Menu.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Menu.java
@@ -1,11 +1,17 @@
 package com.uos.admin.sleepbetter;
 
+import android.app.AlertDialog;
+import android.app.Dialog;
 import android.arch.persistence.room.Room;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -19,26 +25,42 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 
 import static android.content.Context.MODE_PRIVATE;
+import static java.net.Proxy.Type.HTTP;
+import static org.apache.commons.lang3.CharEncoding.UTF_8;
 
 public class Menu extends Fragment {
 
     View mainPage;
     private static final String DATABASE_NAME = "user_db";
+    private int shouldBe;
 
     public Menu(){
 
     }
 
+
+
     @Nullable
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
         mainPage = inflater.inflate(R.layout.act_menu, container, false);
 
+                  if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("menu", true)){
+
+                InfoDialog dia = new InfoDialog();
+                dia.show(getFragmentManager(), "dialog");
 
-        Button myExperimentButton = mainPage.findViewById(R.id.submitButton);
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("menu", false).apply();
+
+        }
+        Button myExperimentButton = mainPage.findViewById(R.id.whatSleep3);
         myExperimentButton.setOnClickListener(new View.OnClickListener() {
 
             public void onClick(View v) {
@@ -47,7 +69,7 @@ public class Menu extends Fragment {
 
         });
 
-        Button button1 = mainPage.findViewById(R.id.whatSleep);
+        Button button1 = mainPage.findViewById(R.id.whatSleep2);
         button1.setOnClickListener(new View.OnClickListener() {
 
             public void onClick(View v) {
@@ -65,6 +87,20 @@ public class Menu extends Fragment {
 
         });
 
+        Button button0 = mainPage.findViewById(R.id.whatSleep);
+        button0.setOnClickListener(new View.OnClickListener() {
+
+            public void onClick(View v) {
+
+                String expStartDate = getActivity().getApplicationContext().getSharedPreferences("date", MODE_PRIVATE).getString("startExperiment", "");
+                if (shouldBe == 0 && expStartDate.equals("")) {
+                    Toast.makeText(getActivity().getApplicationContext(), "Please choose an experiment first.", Toast.LENGTH_LONG).show();
+                } else {
+                    startActivity(new Intent(getActivity(), Settings.class));
+                }
+            }
+
+        });
 
         TextView navUsername = (TextView) mainPage.findViewById(R.id.editText3);
         String name = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
@@ -73,26 +109,34 @@ public class Menu extends Fragment {
 
         TextView participantID = (TextView) mainPage.findViewById(R.id.partID);
         String id = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
-        participantID.setText("Participant ID: " + id);
+        participantID.setText("User ID: " + id);
 
         return mainPage;
 
     }
 
-    private boolean isViewShown = false;
-
     @Override
     public void setUserVisibleHint(boolean isVisibleToUser) {
         super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 0) {
             loadPageDataProcessing();
-        } else {
-            isViewShown = false;
         }
+
     }
 
-    public void loadPageDataProcessing(){
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (tabLayout.getSelectedTabPosition() == 0){
+            loadPageDataProcessing();
+        }
+    }
+
+    public void loadPageDataProcessing() {
 
         Date c = Calendar.getInstance().getTime();
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
@@ -119,7 +163,21 @@ public class Menu extends Fragment {
         Calendar c2 = Calendar.getInstance();
         c2.setTime(date2);
 
-        int shouldBe = c1.get(Calendar.DAY_OF_YEAR) - c2.get(Calendar.DAY_OF_YEAR);
+        shouldBe = c1.get(Calendar.DAY_OF_YEAR) - c2.get(Calendar.DAY_OF_YEAR);
+
+        //adding a new day only after the ques limit - e.g. after 4 am
+        Calendar calendarr = Calendar.getInstance();
+        SimpleDateFormat formatterr = new SimpleDateFormat("HH:mm");
+        String currentHourr = formatterr.format(calendarr.getTime());
+
+        String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        String[] currentHourComponents = currentHourr.split(":");
+
+        if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
+            shouldBe--;
+        }
 
         final int finalShouldBe = shouldBe;
 
@@ -137,10 +195,26 @@ public class Menu extends Fragment {
                 int loggedIn = uDatabase.daoAccess().fetchUserQuestionnaires().size();
 
 
-                int misses = finalShouldBe -loggedIn;
+                int misses = finalShouldBe - loggedIn;
+
+
+                boolean afterQuesLimit = false;
+
+                Calendar calendar1 = Calendar.getInstance();
+                SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm");
+                String currentHour = formatter1.format(calendar1.getTime());
+
+                String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+                String[] lastQuestNotifComponents = quesLimit.split(":");
+
+                String[] currentHourComponents = currentHour.split(":");
 
 
-                if (misses >=1){
+                afterQuesLimit = (Integer.valueOf(currentHourComponents[0]) < 19 && Integer.valueOf(currentHourComponents[0]) > Integer.valueOf(lastQuestNotifComponents[0])) || (Integer.valueOf(currentHourComponents[0]) == Integer.valueOf(lastQuestNotifComponents[0]) && Integer.valueOf(currentHourComponents[1]) > Integer.valueOf(lastQuestNotifComponents[1]));
+
+
+                //if ((misses ==1 && afterQuesLimit) || misses > 1){
+                if (misses >= 1) {
 
                     String moods_string = getActivity().getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).getString("moods", "");
 
@@ -148,10 +222,11 @@ public class Menu extends Fragment {
 
                     ArrayList<String> moodsArrayList = new ArrayList<String>(Arrays.asList(moods));
 
-                    for (int i=0; i<misses; i++){
+                    for (int i = 0; i < misses; i++) {
 
                         UserQuestionnaire user = new UserQuestionnaire();
-                        String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing"); user.setUsername(username);
+                        String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
+                        user.setUsername(username);
                         user.setDate(currentDate);
                         user.setUsername(username);
                         user.setHowLong(-1);
@@ -206,11 +281,11 @@ public class Menu extends Fragment {
 
         String[] experimentsArray = experiments.split("gcm");
 
-        if (shouldBe> experimentsArray.length){
+        if (shouldBe > experimentsArray.length) {
             String currentExperiment = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("experiment", "nothing");
 
             ArrayList<String> experimentsArrayList = new ArrayList<String>(Arrays.asList(experimentsArray));
-            for (int i=0; i< (shouldBe - experimentsArray.length); i++){
+            for (int i = 0; i < (shouldBe - experimentsArray.length); i++) {
                 experimentsArrayList.add(currentExperiment + ".");
             }
 
@@ -226,7 +301,7 @@ public class Menu extends Fragment {
 
         TextView remainedDaysText = (TextView) mainPage.findViewById(R.id.youHave);
 
-        if (expStartDate.equals("")){
+        if (expStartDate.equals("")) {
             remainedDaysText.setText("Please choose your experiment in the Experiments section.");
         } else {
             Date date3 = null;
@@ -245,13 +320,18 @@ public class Menu extends Fragment {
 
             int difference = 5 - (experimentDaysDifference % 5);
 
+            //adding a new day only after the ques limit - e.g. after 4 am
+            if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
+                difference++;
+            }
+
 
             remainedDaysText.setText("You have " + difference + " days left of the current experiment.");
 
 
             if (expStartDate.equals(currentDate)) {
                 remainedDaysText.setText("You have 5 days left of the current experiment.");
-            } else if (difference < 5 && difference != 0){
+            } else if (difference < 5 && difference != 0) {
                 remainedDaysText.setText(difference + " days left of the current experiment.");
             } else {
                 remainedDaysText.setText(difference + " days left of the current experiment. When available, change your experiment in the Experiments section.");
@@ -260,4 +340,30 @@ public class Menu extends Fragment {
         }
 
     }
+
+    public static class InfoDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("Here you can see the main menu - the place where you can read more about the study and the app, as well as your currently chosen experiment. You can also update your name and preferences regarding the app's notifications if you click on the \"Settings\" button. Moreover, this is where you will be able to see how many days you have left of your current experiment. In order to switch between tabs and sections in the app, you can swipe right or click on the titles above.");
+
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/MyCurrentExperiment.java b/app/src/main/java/com/uos/admin/sleepbetter/MyCurrentExperiment.java
index 27bc5447b1c6f718cb1f4d82a4b8b1cecafeda98..e87e10367cfc208ab67ae4e62850d7b4b46fed20 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/MyCurrentExperiment.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/MyCurrentExperiment.java
@@ -2,14 +2,19 @@ package com.uos.admin.sleepbetter;
 
 import android.content.Context;
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
+
 public class MyCurrentExperiment extends AppCompatActivity {
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     protected void onCreate(Bundle savedInstanceState) {
 
 
@@ -29,8 +34,18 @@ public class MyCurrentExperiment extends AppCompatActivity {
 
         });
 
+        TextView fo = findViewById(R.id.descriptionID);
+        fo.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+
         TextView experimentTitle = (TextView) findViewById(R.id.experimentTitleID);
-        experimentTitle.setText("Experiment: " + getApplicationContext().getSharedPreferences("name", Context.MODE_PRIVATE).getString("experiment", " "));
+        String currentExp = getApplicationContext().getSharedPreferences("name", Context.MODE_PRIVATE).getString("experiment", " ");
+
+        if (currentExp.equals(" ")){
+            experimentTitle.setText("No chosen experiment");
+        } else {
+            experimentTitle.setText("Experiment: " + currentExp);
+        }
 
         TextView description = (TextView) findViewById(R.id.descriptionID);
 
@@ -38,34 +53,34 @@ public class MyCurrentExperiment extends AppCompatActivity {
 
         switch (experiment) {
             case 1: //increase bright light exposure
-                description.setText("Exposure to sunlight should occur in the morning upon awakening, typically within the first hour after crawling out of bed. It is best to spend 30 to 45 minutes getting direct sunlight exposure into the eyes;\\nSpend at least half an hour in the sun during the day as well, by exercising, walking or just any other sort of activity;\\nIt is recommended that your bedroom can capture the sunlight during the day - leaving your curtains open;\\nMoreover, don't worry if it's a cloudy day, because even when filtered through clouds or rain, the sunlight will continue to have its effect.");
+                description.setText("Exposure to sunlight should occur in the morning upon awakening, typically within the first hour after crawling out of bed. It is best to spend 30 to 45 minutes getting direct sunlight exposure into the eyes;\nSpend at least half an hour in the sun during the day as well, by exercising, walking or just any other sort of activity;\nIt is recommended that your bedroom can capture the sunlight during the day - leaving your curtains open;\nMoreover, don't worry if it's a cloudy day, because even when filtered through clouds or rain, the sunlight will continue to have its effect.");
                 break;
             case 2: //wear glasses that block blue light during the night
-                description.setText("Blue light - coming from LED screens or even from the sun - in the evening tricks your brain into thinking it’s daytime, which inhibits the production of melatonin and reduces both the quantity and quality of your sleep;\\nWearing sleep masks or glasses during the night is recommended here;\\nAlso, installing the f.lx app ( https://justgetflux.com/ ) would be highly recommended as it warms up your computer display at night, to match your indoor lighting;\\nManually adjusting the brightness on your devices wuld also help with this matter.");
+                description.setText("Blue light - coming from LED screens or even from the sun - in the evening tricks your brain into thinking it’s daytime, which inhibits the production of melatonin and reduces both the quantity and quality of your sleep;\nWearing sleep masks or glasses during the night is recommended here;\nAlso, installing the f.lx app ( https://justgetflux.com/ ) would be highly recommended as it warms up your computer display at night, to match your indoor lighting;\nManually adjusting the brightness on your devices wuld also help with this matter.");
                 break;
             case 3: // turn off any bright lights 2 hours before going to bed
-                description.setText("Light makes you feel alert, which isn't what you want when you need to sleep;\\nTherefore, try turning off the TV, the computer, or any other LED-light device you are using with 2 hours before going to bed.");
+                description.setText("Light makes you feel alert, which isn't what you want when you need to sleep;\nTherefore, try turning off the TV, the computer, or any other LED-light device you are using with 2 hours before going to bed.");
                 break;
             case 5: // Do not drink caffeine within 6 hours
-                description.setText("It is highly recommended not drinking any product containing caffeine with 6 hours before going to sleep;\\nThat is either coffee, soft drinks such as Coke, Fanta etc, some tea brews - such as green tea or black tea, and of course, energy drinks.");
+                description.setText("It is highly recommended not drinking any product containing caffeine with 6 hours before going to sleep;\nThat is either coffee, soft drinks such as Coke, Fanta etc, some tea brews - such as green tea or black tea, and of course, energy drinks.");
                 break;
             case 6: // Limit yourself to 4 cups of coffees per day; 10 canss of
                 description.setText("During the day, please limit yourself to drinking not more than 4 cups of coffee (about 945 ml), 10 cans of soda (about 3.3 l) such as Fanta or Coke, or 2 energy drinks - of any kind.");
                 break;
             case 7: //Do not drink empty stomach
-                description.setText("After you wake up, we highly recommend not drinking any products containing caffeine on empty stomach (before eating any food);\\nThat is either coffee, soft drinks such as Coke, Fanta etc, some tea brews - such as green tea or black tea, and of course, energy drinks.");
+                description.setText("After you wake up, we highly recommend not drinking any products containing caffeine on empty stomach (before eating any food);\nThat is either coffee, soft drinks such as Coke, Fanta etc, some tea brews - such as green tea or black tea, and of course, energy drinks.");
                 break;
             case 9://Usually get up at the same time everyday, even on weekends
-                description.setText("Going to bed and waking up at the same time everyday, even during the weekend, or during holidays;\\nIt's important to have a sleeping schedule as your body loves ROUTINE.");
+                description.setText("Going to bed and waking up at the same time everyday, even during the weekend, or during holidays;\nIt's important to have a sleeping schedule as your body loves ROUTINE.");
                 break;
             case 10: // Sleep no lesss than 7 hours per night
-                description.setText("It can happen very often that you don't feel sleepy close to bedtime. That can be caused by a lot of other factors, like the caffeine in your body, light exposure, adrenaline etc;\\n Either way, before going to sleep, we recommend trying one of the next few activities:\\nTake a warm bath to let your body relax;\\nRead a book to relax your mind;\\nTry doing a few exercises or stretching;\\nDrink a hot cup of tea, but be careful so that it doesn not containt caffeine (such as black tea and green tea);\\nAny other activity that works well for yourself and helps your mind and body relax.");
+                description.setText("It can happen very often that you don't feel sleepy close to bedtime. That can be caused by a lot of other factors, like the caffeine in your body, light exposure, adrenaline etc;\n Either way, before going to sleep, we recommend trying one of the next few activities:\\nTake a warm bath to let your body relax;\\nRead a book to relax your mind;\\nTry doing a few exercises or stretching;\\nDrink a hot cup of tea, but be careful so that it doesn not containt caffeine (such as black tea and green tea);\\nAny other activity that works well for yourself and helps your mind and body relax.");
                 break;
             case 11: //DO not go to bed unless you are tired. If you are not
                 description.setText("Going to sleep no later than 22:30 in order to regulate you sleep cycles to an appropriate bedtime hour.");
                 break;
             case 12: //Go to sleep at 22:30 PM the latest
-                description.setText("Since you haven't chosen an experiment from the \\\"Experiment\\\" section yet, this section is unavailable.");
+                description.setText("Since you haven't chosen an experiment from the \"Experiment\" section yet, this section is unavailable.");
                 break;
         }
     }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/QFinal.java b/app/src/main/java/com/uos/admin/sleepbetter/QFinal.java
index d7cbf2f5b7433132fcca65d4d7010e83ad290079..dc5354eee8fd4bc3fcc3f3939da357886f98fd0b 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/QFinal.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/QFinal.java
@@ -9,17 +9,21 @@ import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
+import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
 import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.RadioGroup;
+import android.widget.TextView;
 import android.widget.Toast;
-import android.support.v4.app.FragmentManager;
+
 
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
@@ -29,22 +33,23 @@ import java.util.Calendar;
 import java.util.Date;
 
 import static android.content.Context.MODE_PRIVATE;
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
-public class QFinal extends Fragment {
+public class QFinal extends AppCompatActivity {
 
    private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
 
     private static boolean goToMenu = false;
 
-    View questionnaireView;
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        questionnaireView = inflater.inflate(R.layout.act_ques_final, container, false);
+    @RequiresApi(api = Build.VERSION_CODES.O)
+    protected void onCreate(Bundle savedInstanceState) {
+
 
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_ques_final);
 
-        Button button = (Button) questionnaireView.findViewById(R.id.submitButton);
+        Button button = (Button) findViewById(R.id.submitButton);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -56,7 +61,14 @@ public class QFinal extends Fragment {
 
         });
 
-        return questionnaireView;
+        TextView cons8 = findViewById(R.id.firstSet);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView sec = findViewById(R.id.secondSet);
+        sec.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView th = findViewById(R.id.thirdSet);
+        th.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
     }
 
     private void loopForSending(){
@@ -64,8 +76,7 @@ public class QFinal extends Fragment {
             goToMenu();
         } else {
             InternetDialog dial = new InternetDialog();
-            FragmentManager fragmentManager = getFragmentManager();
-            dial.show(fragmentManager, "dialog");
+            new InternetDialog().show(getSupportFragmentManager(), "dialog");
         }
     }
 
@@ -96,49 +107,49 @@ public class QFinal extends Fragment {
         int answered = 0;
         double mood =0;
 
-        RadioGroup qGroup = questionnaireView.findViewById(R.id.q1Group);
+        RadioGroup qGroup = findViewById(R.id.q1Group);
         int qID = qGroup.getCheckedRadioButtonId();
         View radioButton = qGroup.findViewById(qID);
         final int howLong = qGroup.indexOfChild(radioButton) +1;
         mood += howLong;
         if (howLong == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q2Group);
+        qGroup = findViewById(R.id.q2Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int awake = qGroup.indexOfChild(radioButton) +1;
         mood += awake;
         if (awake == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q3Group);
+        qGroup = findViewById(R.id.q3Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int earlier = qGroup.indexOfChild(radioButton) +1;
         mood += earlier;
         if (earlier == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q5Group);
+        qGroup = findViewById(R.id.q5Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int quality = qGroup.indexOfChild(radioButton) +1;
         mood += quality;
         if (quality == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q6Group);
+        qGroup = findViewById(R.id.q6Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int impactMood = qGroup.indexOfChild(radioButton) +1;
         mood += impactMood;
         if (impactMood == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q7Group);
+        qGroup = findViewById(R.id.q7Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int impactActivities = qGroup.indexOfChild(radioButton) +1;
         mood += impactActivities;
         if (impactActivities == 0) answered++;
 
-        qGroup = questionnaireView.findViewById(R.id.q8Group);
+        qGroup = findViewById(R.id.q8Group);
         qID = qGroup.getCheckedRadioButtonId();
         radioButton = qGroup.findViewById(qID);
         final int impactGeneral = qGroup.indexOfChild(radioButton) +1;
@@ -146,14 +157,14 @@ public class QFinal extends Fragment {
         if (impactGeneral == 0) answered++;
 
         if (answered > 0){
-            Toast.makeText(questionnaireView.getContext(), "In order to proceed, please answer ALL questions", Toast.LENGTH_LONG).show();
+            Toast.makeText(getApplicationContext(), "In order to proceed, please answer ALL questions", Toast.LENGTH_LONG).show();
         } else {
             mood = mood / 7;
 
             DecimalFormat formatting = new DecimalFormat("#.##");
             mood = Double.parseDouble(formatting.format(mood));
 
-            startActivity(new Intent(getActivity().getApplicationContext(), AllPages.class));
+            startActivity(new Intent(getApplicationContext(), AllPages.class));
 
 
             Date c = Calendar.getInstance().getTime();
@@ -167,10 +178,10 @@ public class QFinal extends Fragment {
                 @Override
                 public void run() {
 
-                    userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                    userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
 
                     UserQuestionnaire user = new UserQuestionnaire();
-                    String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
+                    String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("participantID", "nothing");
                     user.setUsername(username);
                     user.setDate(quesDate);
                     user.setHowLong(howLong);
@@ -184,24 +195,24 @@ public class QFinal extends Fragment {
                     user.setProblem(-1);
                     user.setMood(finalMood);
 
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("howLong", howLong).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("awake", awake).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("earlier", earlier).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("quality", quality).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactMood", impactMood).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactActivities", impactActivities).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactGeneral", impactGeneral).apply();
-                    getActivity().getApplicationContext().getSharedPreferences("MOOD", MODE_PRIVATE).edit().putFloat("mood", (float) finalMood).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("howLong", howLong).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("awake", awake).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("earlier", earlier).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("quality", quality).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactMood", impactMood).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactActivities", impactActivities).apply();
+                    getApplicationContext().getSharedPreferences("questionnaire", MODE_PRIVATE).edit().putInt("impactGeneral", impactGeneral).apply();
+                    getApplicationContext().getSharedPreferences("MOOD", MODE_PRIVATE).edit().putFloat("mood", (float) finalMood).apply();
 
                     userDatabase.daoAccess().insertSingleUserQuestionnaire(user);
 
-                    Report rep = new Report(userDatabase, getActivity().getApplicationContext());
-                    rep.save(username, false, getActivity().getApplicationContext().getSharedPreferences("consent", MODE_PRIVATE).getString("consent", "nothing"));
+                    Report rep = new Report(userDatabase, getApplicationContext());
+                    rep.save(username, false, getApplicationContext().getSharedPreferences("consent", MODE_PRIVATE).getString("consent", "nothing"));
                 }
             }).start();
 
 
-            String moods_string = getActivity().getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).getString("moods", "");
+            String moods_string = getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).getString("moods", "");
 
             String[] moods = moods_string.split("gcm");
 
@@ -215,12 +226,12 @@ public class QFinal extends Fragment {
             for (int i = 0; i < moods.length; i++) {
                 sb.append(moods[i]).append("gcm");
             }
-            getActivity().getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).edit().putString("moods", sb.toString()).apply();
+            getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).edit().putString("moods", sb.toString()).apply();
 
-            String experiments = getActivity().getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).getString("experiments", "");
+            String experiments = getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).getString("experiments", "");
 
             String[] experimentsArray = experiments.split("gcm");
-            String currentExperiment = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("experiment", "nothing");
+            String currentExperiment = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("experiment", "nothing");
 
 
             ArrayList<String> experimentsArrayList = new ArrayList<String>(Arrays.asList(experimentsArray));
@@ -233,20 +244,26 @@ public class QFinal extends Fragment {
             for (int i = 0; i < experimentsArray.length; i++) {
                 sb.append(experimentsArray[i]).append("gcm");
             }
-            getActivity().getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).edit().putString("experiments", sb.toString()).apply();
+            getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).edit().putString("experiments", sb.toString()).apply();
 
-            getActivity().getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "picked");
-            getActivity().getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "picked").apply();
+            getSharedPreferences("exp", MODE_PRIVATE).getString("picked", "picked");
+            getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "picked").apply();
 
         }
     }
 
     public boolean isConnected() {
         ConnectivityManager
-                cm = (ConnectivityManager) getActivity().getApplicationContext()
+                cm = (ConnectivityManager) getApplicationContext()
                 .getSystemService(Context.CONNECTIVITY_SERVICE);
         NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
         return activeNetwork != null
                 && activeNetwork.isConnectedOrConnecting();
     }
+
+    @Override
+    public void onBackPressed() {
+        Toast.makeText(getApplicationContext(), "I'm sorry, you can't go back to the previous Pre-Questionnaire section.", Toast.LENGTH_LONG).show();
+
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/QInitial.java b/app/src/main/java/com/uos/admin/sleepbetter/QInitial.java
index 8800d4fa8bf2e8761ca62ca9056d9e63b00bdfac..d392e5825cd5017aa5656242ce959226bcedfcd6 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/QInitial.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/QInitial.java
@@ -8,13 +8,16 @@ import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Button;
 import android.widget.RadioGroup;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import java.text.DecimalFormat;
@@ -23,6 +26,8 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
+
 public class QInitial extends AppCompatActivity {
 
 
@@ -30,6 +35,7 @@ public class QInitial extends AppCompatActivity {
     private UserDatabase userDatabase;
     private static boolean goToMenu = false;
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Override
     protected void onCreate(Bundle savedInstanceState) {
 
@@ -47,6 +53,18 @@ public class QInitial extends AppCompatActivity {
 
         });
 
+        TextView cons8 = findViewById(R.id.firstSet);
+        cons8.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView sec = findViewById(R.id.secondSet);
+        sec.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView th = findViewById(R.id.thirdSet);
+        th.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView fo = findViewById(R.id.fourthSet);
+        fo.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
     }
 
     private void loopForSending(){
@@ -237,7 +255,22 @@ public class QInitial extends AppCompatActivity {
             }
             getApplicationContext().getSharedPreferences("moods", MODE_PRIVATE).edit().putString("moods", sb.toString()).apply();
 
-            getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "picked").apply();
+            getApplicationContext().getSharedPreferences("exp", MODE_PRIVATE).edit().putString("picked", "picked").apply();
+
+
+            //settings
+            getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putString("limit", "0:0").apply();
+            getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putInt("nrNotif", 1).apply();
+            getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putBoolean("disableAll", false).apply();
+            getApplicationContext().getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit().putBoolean("isFirstRun", false).apply();
+
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("menu", true).apply();
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("experiments", true).apply();
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("data", true).apply();
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("diary", true).apply();
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("calendar", true).apply();
+            getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("questionnaire", true).apply();
+
         }
     }
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcast.java b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcast.java
index a9ddfa06fe8ce132ac077b1e165fcf2ff9169a49..af73a1ed8e8bf071ef84cf4a181ae360eae222a0 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcast.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcast.java
@@ -29,10 +29,11 @@ public class QuestionnaireBroadcast extends BroadcastReceiver {
             NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(context, "13")
                     .setSmallIcon(R.drawable.pillow)
                     .setContentTitle("Questionnaire")
+                    .setStyle(new NotificationCompat.BigTextStyle().bigText("Remember to complete the daily questionnaire!"))
                     .setContentText("Remember to complete the daily questionnaire!")
                     .setAutoCancel(false)
                     .setWhen(when)
-                    .setOngoing(true)
+                    .setOngoing(false)
                     .setContentIntent(pendingIntent);
             notificationManager.notify(20, mNotifyBuilder.build());
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastThree.java b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastThree.java
new file mode 100644
index 0000000000000000000000000000000000000000..c886b63db99542fe55d1ff39cb5984159563379d
--- /dev/null
+++ b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastThree.java
@@ -0,0 +1,40 @@
+package com.uos.admin.sleepbetter;
+
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.support.v4.app.NotificationCompat;
+
+import static com.uos.admin.sleepbetter.AllPages.nextclass;
+
+public class QuestionnaireBroadcastThree extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+
+
+        long when = System.currentTimeMillis();
+        NotificationManager notificationManager = (NotificationManager) context
+                .getSystemService(Context.NOTIFICATION_SERVICE);
+
+        Intent notificationIntent = new Intent(context, nextclass);
+        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
+                notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+
+
+            NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(context, "13")
+                    .setSmallIcon(R.drawable.pillow)
+                    .setContentTitle("Questionnaire")
+                    .setStyle(new NotificationCompat.BigTextStyle().bigText("Remember to complete the daily questionnaire if you haven't yet!"))
+                    .setContentText("Remember to complete the daily questionnaire if you haven't yet!")
+                    .setAutoCancel(false)
+                    .setWhen(when)
+                    .setOngoing(false)
+                    .setContentIntent(pendingIntent);
+            notificationManager.notify(22, mNotifyBuilder.build());
+
+    }
+    }
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastTwo.java b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastTwo.java
new file mode 100644
index 0000000000000000000000000000000000000000..025aaccdd16c7f5b43b355cadb18c30780616cfa
--- /dev/null
+++ b/app/src/main/java/com/uos/admin/sleepbetter/QuestionnaireBroadcastTwo.java
@@ -0,0 +1,40 @@
+package com.uos.admin.sleepbetter;
+
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.support.v4.app.NotificationCompat;
+
+import static com.uos.admin.sleepbetter.AllPages.nextclass;
+
+public class QuestionnaireBroadcastTwo extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+
+
+        long when = System.currentTimeMillis();
+        NotificationManager notificationManager = (NotificationManager) context
+                .getSystemService(Context.NOTIFICATION_SERVICE);
+
+        Intent notificationIntent = new Intent(context, nextclass);
+        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
+                notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+
+
+            NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(context, "13")
+                    .setSmallIcon(R.drawable.pillow)
+                    .setContentTitle("Questionnaire")
+                    .setStyle(new NotificationCompat.BigTextStyle().bigText("Remember to complete the daily questionnaire if you haven't yet!"))
+                    .setContentText("Remember to complete the daily questionnaire if you haven't yet!")
+                    .setAutoCancel(false)
+                    .setWhen(when)
+                    .setOngoing(false)
+                    .setContentIntent(pendingIntent);
+            notificationManager.notify(21, mNotifyBuilder.build());
+
+    }
+    }
\ No newline at end of file
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Report.java b/app/src/main/java/com/uos/admin/sleepbetter/Report.java
index 971e64cd903058e6e62177452863eb29b45aa991..89ed9e86b15942ff5f05435def68c62098f59a98 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Report.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Report.java
@@ -2,13 +2,24 @@ package com.uos.admin.sleepbetter;
 
 import android.content.Context;
 
+import com.android.volley.AuthFailureError;
+import com.android.volley.Request;
+import com.android.volley.RequestQueue;
+import com.android.volley.Response;
+import com.android.volley.VolleyError;
+import com.android.volley.toolbox.StringRequest;
+import com.android.volley.toolbox.Volley;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import javax.activation.DataHandler;
@@ -63,19 +74,19 @@ public class Report {
             impact_general += String.valueOf(uq.get(i).getImpactGeneral()) + ", ";
             mood += String.valueOf(uq.get(i).getMood()) + ", ";
         }
-        stats += "Username: " + uq.get(0).getUsername() + "/ " +
-                "Date: " + date + "/ " +
-                "How long: " + how_long + "/ " +
-                "Awake: " + awake + "/ " +
-                "Earlier: " + earlier + "/ " +
-                "Nights A Week: " + nightsAWeek + "/ " +
-                "Quality: " + quality + "/ " +
-                "Impact mood: " + impact_mood + "/ " +
-                "Impact activities: " + impact_activities + "/ " +
-                "Impact general: " + impact_general + "/ " +
-                "Problem: " + problem + "/ " +
-                "Mood: " + mood + "/ " +
-                "Demographics: " + demographics + "/ ";
+        stats += "User ID: " + uq.get(0).getUsername() + "\n " +
+                "Date: " + date + "\n  " +
+                "How long: " + how_long + "\n  " +
+                "Awake: " + awake + "\n  " +
+                "Earlier: " + earlier + "\n " +
+                "Nights A Week: " + nightsAWeek + "\n " +
+                "Quality: " + quality + "\n  " +
+                "Impact mood: " + impact_mood + "\n " +
+                "Impact activities: " + impact_activities + "\n  " +
+                "Impact general: " + impact_general + "\n  " +
+                "Problem: " + problem + "\n  " +
+                "Mood: " + mood + "\n  " +
+                "Demographics: " + demographics + "\n  ";
 
 
         String experimentsList = "";
@@ -138,31 +149,31 @@ public class Report {
                 overall_better += String.valueOf(ue.get(i).getOverallBetter()) + ", ";
             }
 
-            experimentsList += "Username: " + uq.get(0).getUsername() + "/ " +
-                    "Date: " + date2 + "/ " +
-                    "Experiment: " + experiment2 + "/ " +
-                    "L1 sunlight exposure: " + l1_1 + "/ " +
-                    "L1 half an hour: " + l1_2 + "/ " +
-                    "L1 captures sunlight: " + l1_3 + "/ " +
-                    "L2 app: " + l2_1 + "/ " +
-                    "L2 glasses: " + l2_2 + "/ " +
-                    "L3 bright: " + l3_1 + "/ " +
-                    "L3 TV: " + l3_2 + "/ " +
-                    "C1 when drink: " + c1_1 + "/ " +
-                    "C1 when sleep: " + c1_2 + "/ " +
-                    "C2 cups: " + c2_1 + "/ " +
-                    "C2 cans: " + c2_2 + "/ " +
-                    "C2 energy: " + c2_3 + "/ " +
-                    "C3 drink: " + c3_1 + "/ " +
-                    "C3 empty: " + c3_2 + "/ " +
-                    "S1 when sleep: " + s1_1 + "/ " +
-                    "S1 when wake: " + s1_2 + "/ " +
-                    "S2 when sleep: " + s2_1 + "/ " +
-                    "S2 when wake: " + s2_2 + "/ " +
-                    "S3 relaxed: " + s3_1 + "/ " +
-                    "S3 activity: " + s3_2 + "/ " +
-                    "S4 when sleep: " + s4_1 + "/ " +
-                    "Overall better: " + overall_better + "/ ";
+            experimentsList += "Username: " + uq.get(0).getUsername() + "\n " +
+                    "Date: " + date2 + "\n  " +
+                    "Experiment: " + experiment2 + "\n  " +
+                    "L1 sunlight exposure: " + l1_1 + "\n  " +
+                    "L1 half an hour: " + l1_2 + "\n  " +
+                    "L1 captures sunlight: " + l1_3 + "\n  " +
+                    "L2 app: " + l2_1 + "\n  " +
+                    "L2 glasses: " + l2_2 + "\n  " +
+                    "L3 bright: " + l3_1 + "\n  " +
+                    "L3 TV: " + l3_2 + "\n  " +
+                    "C1 when drink: " + c1_1 + "\n  " +
+                    "C1 when sleep: " + c1_2 + "\n  " +
+                    "C2 cups: " + c2_1 + "\n  " +
+                    "C2 cans: " + c2_2 + "\n  " +
+                    "C2 energy: " + c2_3 + "\n  " +
+                    "C3 drink: " + c3_1 + "\n  " +
+                    "C3 empty: " + c3_2 + "\n  " +
+                    "S1 when sleep: " + s1_1 + "\n  " +
+                    "S1 when wake: " + s1_2 + "\n  " +
+                    "S2 when sleep: " + s2_1 + "\n  " +
+                    "S2 when wake: " + s2_2 + "\n  " +
+                    "S3 relaxed: " + s3_1 + "\n  " +
+                    "S3 activity: " + s3_2 + "\n  " +
+                    "S4 when sleep: " + s4_1 + "\n  " +
+                    "Overall better: " + overall_better + "\n  ";
 
 
         }
@@ -172,16 +183,66 @@ public class Report {
 
 
         String date3 = "";
-        String comment = String.valueOf(uq.get(0).getProblem());
+        String comment = "";
         for (int i = 0; i < ud.size(); i++) {
             date3 += String.valueOf(ud.get(i).getDate()) + ", ";
             comment += String.valueOf(ud.get(i).getComment()) + ", ";
 
         }
-        stats += "Date: " + date3 + "/ " +
+        stats += "Date: " + date3 + "\n  " +
                 "Comment: " + comment;
 
+        /*
+        // Instantiate the RequestQueue.
+        final RequestQueue requestQueue = Volley.newRequestQueue(context);
+        String server_urlpost = "https://hooks.slack.com/services/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"; //Points to target which is obtained from IPV4 Address from IP Config
+
+        final String finalStats = stats;
+        StringRequest stringRequestpost = new StringRequest(Request.Method.POST, server_urlpost,
+
+                new Response.Listener<String>() {
+                    @Override
+                    public void onResponse(String response) {   //Server Response Handler
+                        System.out.println(response);
+                        requestQueue.stop();
+                    }
+                }, new Response.ErrorListener() {
+            @Override
+            public void onErrorResponse(VolleyError error) {    //On Error Response Handler
+                System.out.println("Something went wrong...");
+                error.printStackTrace();
+                requestQueue.stop();
+            }
+        }){
+            @Override
+            public byte[] getBody() throws AuthFailureError {
+
+                byte[] body = new byte[0];
+
+                String bodyToSend = "{\"text\": \" "+ finalStats +"\"}";
+                try {
+                    body = bodyToSend.getBytes("UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                }
+                return body;
+            }
+            @Override
+            public Map<String, String> getHeaders() throws AuthFailureError {
+                Map<String,String> headers=new HashMap<String,String>();
+                headers.put("Accept", "application/json");
+
+                return headers;
+            }
+            @Override
+            public String getBodyContentType() {    //Sets type to json
+                return "application/json";
+            }
+        };
 
+        //Starts Request
+        requestQueue.add(stringRequestpost);
+*/
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Settings.java b/app/src/main/java/com/uos/admin/sleepbetter/Settings.java
index 53c4528067eb7a475283ceca3c291c61c0dbdfcd..7dd23949213c69f9286d30f78e9b49722c1b6b1c 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Settings.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Settings.java
@@ -1,18 +1,43 @@
 package com.uos.admin.sleepbetter;
 
+import android.app.AlarmManager;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+import android.widget.TimePicker;
+import android.widget.Toast;
+
+import java.util.Calendar;
 
 public class Settings extends AppCompatActivity {
 
-    protected void onCreate(Bundle savedInstanceState) {
+    private TextView navUsername;
+
+    @RequiresApi(api = Build.VERSION_CODES.M)
 
+    private TimePicker tpCurrentNotification = null;
+    private TimePicker toQuesNotif = null;
+    private RadioGroup group;
+private CheckBox disableAllCheckBox;
+
+    @RequiresApi(api = Build.VERSION_CODES.M)
+    protected void onCreate(Bundle savedInstanceState) {
 
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.act_notice);
+        setContentView(R.layout.act_settings);
 
 
         Button button = (Button) findViewById(R.id.submitButton);
@@ -20,12 +45,288 @@ public class Settings extends AppCompatActivity {
 
             public void onClick(View v) {
 
-                Intent intent = new Intent(getApplicationContext(), QInitial.class);
+                if (toQuesNotif.getHour() < 11) {
+                    saveSettings();
+                } else {
+                    Toast.makeText(getApplicationContext(), "I'm sorry, you can't choose the limit for your questionnaire to be before 12AM or after 10 AM.", Toast.LENGTH_LONG).show();
+
+                }
 
-                startActivity(intent);
             }
 
         });
 
+        navUsername = (TextView) findViewById(R.id.yourName2);
+        String name = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+        navUsername.setText(name);
+
+
+        TextView currentExperimentView = (TextView) findViewById(R.id.exp);
+
+        currentExperimentView.setText("Experiment: " + getApplicationContext().getSharedPreferences("name", Context.MODE_PRIVATE).getString("experiment", " "));
+
+        String currentnotif = getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("currentNot", "nothing");
+        String quesLimit = getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        int nrNotif = getSharedPreferences("notif", MODE_PRIVATE).getInt("nrNotif", 0);
+        boolean disableAll = getSharedPreferences("notif", MODE_PRIVATE).getBoolean("disableAll", false);
+
+        String[] currentNotifComponents = currentnotif.split(":");
+
+        tpCurrentNotification = (TimePicker) findViewById(R.id.lastDrink2);
+        tpCurrentNotification.setHour(Integer.valueOf(currentNotifComponents[0]));
+        tpCurrentNotification.setMinute(Integer.valueOf(currentNotifComponents[1]));
+
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        toQuesNotif = (TimePicker) findViewById(R.id.lastDrink3);
+        toQuesNotif.setHour(Integer.valueOf(lastQuestNotifComponents[0]));
+        toQuesNotif.setMinute(Integer.valueOf(lastQuestNotifComponents[1]));
+
+        group = (RadioGroup) findViewById(R.id.radioGroup);
+
+        RadioButton savedCheckedRadioButton = (RadioButton)group.getChildAt(nrNotif - 1);
+        savedCheckedRadioButton.setChecked(true);
+
+         disableAllCheckBox = (CheckBox) findViewById(R.id.checkBox);
+        if (disableAll){
+            disableAllCheckBox.setChecked(true);
+        } else {
+            disableAllCheckBox.setChecked(false);
+        }
+
+
+    }
+
+    @RequiresApi(api = Build.VERSION_CODES.M)
+    public void saveSettings(){
+
+        String newName = String.valueOf(navUsername.getText());
+        getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).edit().putString("username", newName).apply();
+
+
+        getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putString("currentNot", String.valueOf(tpCurrentNotification.getHour()) + ":" + String.valueOf(tpCurrentNotification.getMinute())).apply();
+        getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putString("limit", String.valueOf(toQuesNotif.getHour()) + ":" + String.valueOf(toQuesNotif.getMinute())).apply();
+
+        int qID = group.getCheckedRadioButtonId();
+        View radioButton = group.findViewById(qID);
+        final int nr = group.indexOfChild(radioButton) +1;
+        getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).edit().putInt("nrNotif", nr).apply();
+
+
+        getSharedPreferences("notif", MODE_PRIVATE).edit().putBoolean("disableAll", disableAllCheckBox.isChecked()).apply();
+
+        //now remove all notifications
+/*
+        AlarmManager am = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+        Intent cancelServiceIntent = new Intent(getApplicationContext(), ExperimentBroadcast.class);
+        PendingIntent cancelServicePendingIntent = PendingIntent.getBroadcast(
+                getApplicationContext(),
+                13, // integer constant used to identify the service
+                cancelServiceIntent,
+                0 //no FLAG needed for a service cancel
+        );
+        am.cancel(cancelServicePendingIntent);
+
+        Intent cancelServiceIntent2 = new Intent(getApplicationContext(), QuestionnaireBroadcast.class);
+        PendingIntent cancelServicePendingIntent2 = PendingIntent.getBroadcast(
+                getApplicationContext(),
+                20, // integer constant used to identify the service
+                cancelServiceIntent2,
+                0 //no FLAG needed for a service cancel
+        );
+        am.cancel(cancelServicePendingIntent2);
+
+        Intent cancelServiceIntent3 = new Intent(getApplicationContext(), QuestionnaireBroadcastTwo.class);
+        PendingIntent cancelServicePendingIntent3 = PendingIntent.getBroadcast(
+                getApplicationContext(),
+                21, // integer constant used to identify the service
+                cancelServiceIntent3,
+                0 //no FLAG needed for a service cancel
+        );
+        am.cancel(cancelServicePendingIntent3);
+
+        Intent cancelServiceIntent4 = new Intent(getApplicationContext(), QuestionnaireBroadcastThree.class);
+        PendingIntent cancelServicePendingIntent4 = PendingIntent.getBroadcast(
+                getApplicationContext(),
+                22, // integer constant used to identify the service
+                cancelServiceIntent4,
+                0 //no FLAG needed for a service cancel
+        );
+        am.cancel(cancelServicePendingIntent4);
+*
+
+ */
+        Intent intentt = new Intent(getApplicationContext(), ExperimentBroadcast.class);
+        PendingIntent pintent = PendingIntent.getBroadcast(this, 0, intentt, 0);
+        AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
+        stopService(intentt);
+        alarm.cancel(pintent);
+
+
+        Intent intentt2 = new Intent(getApplicationContext(), QuestionnaireBroadcast.class);
+        PendingIntent pintent2 = PendingIntent.getBroadcast(this, 0, intentt2, 0);
+        AlarmManager alarm2 = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
+        stopService(intentt2);
+        alarm2.cancel(pintent2);
+
+
+        Intent intentt3 = new Intent(getApplicationContext(), QuestionnaireBroadcastTwo.class);
+        PendingIntent pintent3 = PendingIntent.getBroadcast(this, 0, intentt3, 0);
+        AlarmManager alarm3 = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
+        stopService(intentt3);
+        alarm3.cancel(pintent3);
+
+        Intent intentt4 = new Intent(getApplicationContext(), QuestionnaireBroadcastThree.class);
+        PendingIntent pintent4 = PendingIntent.getBroadcast(this, 0, intentt4, 0);
+        AlarmManager alarm4 = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
+        stopService(intentt4);
+        alarm4.cancel(pintent4);
+
+
+        if (!disableAllCheckBox.isChecked()){
+
+            createExperimentNotification();
+
+            createQuestionnaireOneNotification();
+
+            int difference = 5 + (toQuesNotif.getHour());
+
+
+            if (nr == 2){
+
+                int divided = difference / 2;
+                createQuestionnaireTwoNotification(divided);
+            } else if (nr == 3){
+                int divided = difference / 2;
+                createQuestionnaireTwoNotification(divided);
+                createQuestionnaireThreeNotification(divided * 2);
+            }
+
+        }
+
+
+        startActivity(new Intent(getApplicationContext(), AllPages.class));
+    }
+
+    private void createQuestionnaireOneNotification() {
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                CharSequence name = "reminder";
+                int importance = NotificationManager.IMPORTANCE_DEFAULT;
+                NotificationChannel channel = new NotificationChannel("13", name, importance);
+                // Register the channel with the system; you can't change the importance
+                // or other notification behaviors after this
+                NotificationManager notificationManager = getSystemService(NotificationManager.class);
+                notificationManager.createNotificationChannel(channel);
+
+
+            }
+
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.HOUR_OF_DAY, 19);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+
+            if (Calendar.getInstance().after(calendar)) {
+                calendar.add(Calendar.DAY_OF_MONTH, 1);
+            }
+
+            Intent intent1 = new Intent(getApplicationContext(), QuestionnaireBroadcast.class);
+            PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent1, 0);
+            AlarmManager am1 = (AlarmManager) getSystemService(getApplicationContext().ALARM_SERVICE);
+            am1.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
+
+
+        }
+
+    private void createQuestionnaireTwoNotification(int difference) {
+
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            CharSequence name = "reminder";
+            int importance = NotificationManager.IMPORTANCE_DEFAULT;
+            NotificationChannel channel = new NotificationChannel("13", name, importance);
+            // Register the channel with the system; you can't change the importance
+            // or other notification behaviors after this
+            NotificationManager notificationManager = getSystemService(NotificationManager.class);
+            notificationManager.createNotificationChannel(channel);
+
+
+        }
+
+        int newHour = 0;
+        if (difference + 19 >= 24){
+            newHour = (difference + 19) - 24;
+        } else {
+            newHour = 19 + difference;
+        }
+        System.out.println("FIRST HOUR");
+        System.out.println(newHour);
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, newHour - 1);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+
+        if (Calendar.getInstance().after(calendar)) {
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
+        }
+        Intent intent1 = new Intent(getApplicationContext(), QuestionnaireBroadcastTwo.class);
+        PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent1, 0);
+        AlarmManager am1 = (AlarmManager) getSystemService(getApplicationContext().ALARM_SERVICE);
+        am1.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
+    }
+
+    private void createQuestionnaireThreeNotification(int difference) {
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            CharSequence name = "reminder";
+            int importance = NotificationManager.IMPORTANCE_DEFAULT;
+            NotificationChannel channel = new NotificationChannel("13", name, importance);
+            // Register the channel with the system; you can't change the importance
+            // or other notification behaviors after this
+            NotificationManager notificationManager = getSystemService(NotificationManager.class);
+            notificationManager.createNotificationChannel(channel);
+
+
+        }
+
+        int newHour = 0;
+        if (difference + 19 >= 24){
+            newHour = (difference + 19) - 24;
+        } else {
+            newHour = 19 + difference;
+        }
+        System.out.println("SECOND HOUR");
+        System.out.println(newHour);
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, newHour - 1);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+
+        if (Calendar.getInstance().after(calendar)) {
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
+        }
+        Intent intent1 = new Intent(getApplicationContext(), QuestionnaireBroadcastThree.class);
+        PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent1, 0);
+        AlarmManager am1 = (AlarmManager) getSystemService(getApplicationContext().ALARM_SERVICE);
+        am1.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
+    }
+
+    @RequiresApi(api = Build.VERSION_CODES.M)
+    private void createExperimentNotification() {
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, tpCurrentNotification.getHour());
+        calendar.set(Calendar.MINUTE, tpCurrentNotification.getMinute());
+        calendar.set(Calendar.SECOND, 0);
+
+        if (Calendar.getInstance().after(calendar)) {
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
+        }
+
+        Intent intent1 = new Intent(getApplicationContext(), ExperimentBroadcast.class);
+        PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent1, 0);
+        AlarmManager am = (AlarmManager) getSystemService(getApplicationContext().ALARM_SERVICE);
+        am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
     }
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update.java b/app/src/main/java/com/uos/admin/sleepbetter/Update.java
index d1eef057fc7c80dcfe58dd46726a5e975cd52782..e407b733ed6fd03af459bb2cf90ca209f6ff918c 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update.java
@@ -1,7 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
@@ -25,9 +31,51 @@ public class Update extends Fragment {
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         helpView = inflater.inflate(R.layout.act_update, container, false);
 
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() == null && tabLayout.getSelectedTabPosition() == 5) {
+            loadPageDataProcessing();
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("questionnaire", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("questionnaire", false).apply();
+
+            }
+        }
+
         return helpView;
     }
 
+    @Override
+    public void setUserVisibleHint(boolean isVisibleToUser) {
+        super.setUserVisibleHint(isVisibleToUser);
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (getView() != null && tabLayout.getSelectedTabPosition() == 5) {
+            loadPageDataProcessing();
+            if (getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).getBoolean("questionnaire", true) == true){
+
+                InfoFirstDialog dia = new InfoFirstDialog();
+                dia.show(getFragmentManager(), "dialog");
+
+                getActivity().getApplicationContext().getSharedPreferences("firstnotice", MODE_PRIVATE).edit().putBoolean("questionnaire", false).apply();
+
+            }
+        }
+
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        TabLayout tabLayout = (TabLayout) AllPages.tabLayout;
+        if (tabLayout.getSelectedTabPosition() == 5){
+            loadPageDataProcessing();
+        }
+    }
+
     private boolean checkIfAllowsQuestionnaire(){
 
         Calendar calendar1 = Calendar.getInstance();
@@ -61,21 +109,35 @@ public class Update extends Fragment {
 
         int shouldBe = c1.get(Calendar.DAY_OF_YEAR) - c2.get(Calendar.DAY_OF_YEAR);
 
+        //adding a new day only after the ques limit - e.g. after 4 am
+        Calendar calendarr = Calendar.getInstance();
+        SimpleDateFormat formatterr = new SimpleDateFormat("HH:mm");
+        String currentHourr = formatterr.format(calendarr.getTime());
+
+        String quesLimit = getActivity().getApplicationContext().getSharedPreferences("notif", MODE_PRIVATE).getString("limit", "0:0");
+        String[] lastQuestNotifComponents = quesLimit.split(":");
+
+        String[] currentHourComponents = currentHourr.split(":");
+        if (Integer.valueOf(currentHourComponents[0]) < Integer.valueOf(lastQuestNotifComponents[0])) {
+            shouldBe--;
+        }
 
         String experiments = getActivity().getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).getString("experiments", "");
 
         String[] experimentsArray = experiments.split("gcm");
 
-        System.out.println(experimentsArray.length);
-        if (getActivity().getApplicationContext().getSharedPreferences("experiments", MODE_PRIVATE).getString("experiments", "").equals("No experiment for the initial day.") && shouldBe == 0) {
-            Toast.makeText(getActivity().getApplicationContext(), "You are not allowed to fill in today's questionnaire. Choose an experiment if you haven't.", Toast.LENGTH_LONG).show();
-            return false;
-        } else if (currentHour.compareTo("18:59") < 0) {
-            Toast.makeText(getActivity().getApplicationContext(), "You are not allowed to fill in today's questionnaire yet. Come back at 19:00.", Toast.LENGTH_LONG).show();
 
+        if (experiments.equals("No experiment for the initial day.") && shouldBe == 0) {
+            System.out.println("gggG");
+            Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you cannot fill in today's questionnaire as this is the first day. Please choose an experiment if you haven't yet.", Toast.LENGTH_LONG).show();
             return false;
         } else if (experimentsArray.length - shouldBe >= 1) {
-            Toast.makeText(getActivity().getApplicationContext(), "You are not allowed to fill in today's questionnaire. Come back tomorrow.", Toast.LENGTH_LONG).show();
+            Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you cannot fill in today's questionnaire. Come back tomorrow.", Toast.LENGTH_LONG).show();
+            System.out.println("gggGefw4f");
+            return false;
+        } else if ((Integer.valueOf(currentHourComponents[0]) < 19 && Integer.valueOf(currentHourComponents[0]) > Integer.valueOf(lastQuestNotifComponents[0])) || (Integer.valueOf(currentHourComponents[0]) == Integer.valueOf(lastQuestNotifComponents[0]) && Integer.valueOf(currentHourComponents[1]) > Integer.valueOf(lastQuestNotifComponents[1]))) {
+            Toast.makeText(getActivity().getApplicationContext(), "I'm sorry, you cannot fill in today's questionnaire yet. Come back at 19:00.", Toast.LENGTH_LONG).show();
+            System.out.println("gggGwww");
             return false;
         } else {
             return true;
@@ -83,54 +145,64 @@ public class Update extends Fragment {
 
     }
 
-    private boolean isViewShown = false;
-
-    @Override
-    public void setUserVisibleHint(boolean isVisibleToUser) {
-        super.setUserVisibleHint(isVisibleToUser);
-        if (getView() != null) {
-            isViewShown = true;
-            loadPageDataProcessing();
-        } else {
-            isViewShown = false;
-        }
-    }
 
     public void loadPageDataProcessing(){
-        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
-
         String experiment = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("experiment", "nothing");
 
+        System.out.println(checkIfAllowsQuestionnaire());
         if (checkIfAllowsQuestionnaire()) {
 
             if (experiment.equals(getString(R.string.firstLight))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Light_Bright());
+                startActivity(new Intent(getActivity(), Update_Light_Bright.class));
             } else if (experiment.equals(getString(R.string.secondLight))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Light_Glasses());
+                startActivity(new Intent(getActivity(), Update_Light_Glasses.class));
             } else if (experiment.equals(getString(R.string.thirdLight))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Light_TurnOffBright());
+                startActivity(new Intent(getActivity(), Update_Light_TurnOffBright.class));
             } else if (experiment.equals(getString(R.string.firstCaffeine))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Caffeine_6hours());
+                startActivity(new Intent(getActivity(), Update_Caffeine_6hours.class));
             } else if (experiment.equals(getString(R.string.secondCaffeine))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Caffeine_limit());
+                startActivity(new Intent(getActivity(), Update_Caffeine_limit.class));
             } else if (experiment.equals(getString(R.string.thirdCaffeine))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Caffeine_Empty());
+                startActivity(new Intent(getActivity(), Update_Caffeine_Empty.class));
             } else if (experiment.equals(getString(R.string.firstSchedule))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Schedule_SameTime());
+                startActivity(new Intent(getActivity(), Update_Schedule_SameTime.class));
             } else if (experiment.equals(getString(R.string.secondSchedule))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Schedule_7hours());
+                startActivity(new Intent(getActivity(), Update_Schedule_7hours.class));
             } else if (experiment.equals(getString(R.string.thirdSchedule))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Schedule_Relax());
+                startActivity(new Intent(getActivity(), Update_Schedule_Relax.class));
             } else if (experiment.equals(getString(R.string.fourthSchedule))) {
-                fragmentTransaction.replace(R.id.content_frame, new Update_Schedule_Midnight());
+                startActivity(new Intent(getActivity(), Update_Schedule_Midnight.class));
             } else {
-                fragmentTransaction.replace(R.id.content_frame, new Update());
+                startActivity(new Intent(getActivity(), Update.class));
             }
 
-            fragmentTransaction.addToBackStack(null);
-            fragmentTransaction.commit();
-            getFragmentManager().executePendingTransactions();
         }
 
     }
+
+    public static class InfoFirstDialog extends DialogFragment {
+
+        private String message;
+        private int hour, minute;
+
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            // Use the Builder class for convenient dialog construction
+            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+            builder.setMessage("This is the page you will have to access after 7PM everyday in order to fill in the daily questionnaire. If you try to complete it at the different time, you will get a notice saying that is not possible. The limit for completing the questionnaire (the default is 12AM) can be extended in the Settings. First, you will be asked a few (3-4) questions about your experiment, and afterwards the questionnaire (with 7 questions) will begin. You will not be able to go back after starting the questionnaire so please make sure you have 1-2 minutes for filling this in before closing the app.");
+
+            builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int id) {
+                    dialog.dismiss();
+                }
+            });
+
+            return builder.create();
+        }
+
+
+    }
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_6hours.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_6hours.java
index bc787ace3ae10287409129082d38a8fc16ad5656..2d58f0e34f21d7fd5bc0fe8c7aa31678167221ed 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_6hours.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_6hours.java
@@ -2,11 +2,13 @@ package com.uos.admin.sleepbetter;
 
 
 import android.arch.persistence.room.Room;
+import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -24,19 +26,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Caffeine_6hours extends Fragment {
+public class Update_Caffeine_6hours extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
 
-    View updateView;
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_caffeine_six, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
 
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_caffeine_six);
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -48,7 +48,6 @@ public class Update_Caffeine_6hours extends Fragment {
 
         });
 
-        return updateView;
     }
 
     public void goToQuestionnaire(){
@@ -57,17 +56,17 @@ public class Update_Caffeine_6hours extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        final TimePicker tpLastdrink = (TimePicker) updateView.findViewById(R.id.lastDrink);
+        final TimePicker tpLastdrink = (TimePicker) findViewById(R.id.lastDrink);
         final String lastDrink = tpLastdrink.getCurrentHour() + ":" + tpLastdrink.getCurrentMinute();
 
-        final TimePicker tpWhenSleep = (TimePicker) updateView.findViewById(R.id.whenSleep);
+        final TimePicker tpWhenSleep = (TimePicker) findViewById(R.id.whenSleep);
         final String whenSleep = tpWhenSleep.getCurrentHour() + ":" + tpWhenSleep.getCurrentMinute();
 
 
@@ -75,9 +74,9 @@ public class Update_Caffeine_6hours extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("C1");
@@ -91,10 +90,7 @@ public class Update_Caffeine_6hours extends Fragment {
             }
         }).start();
 
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_Empty.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_Empty.java
index 1158bdbb2d9892ec4cce80a8eeff8357f5bbd0d9..6b183a4f39c6e16c1c01410ccf9a4015cc811c80 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_Empty.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_Empty.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,17 +25,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Caffeine_Empty extends Fragment {
+public class Update_Caffeine_Empty extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_caffeine_empty, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_caffeine_empty);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -46,7 +48,6 @@ public class Update_Caffeine_Empty extends Fragment {
         });
 
 
-        return updateView;
     }
 
     public void goToQuestionnaire() {
@@ -55,7 +56,7 @@ public class Update_Caffeine_Empty extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
@@ -63,14 +64,14 @@ public class Update_Caffeine_Empty extends Fragment {
         final String testCompared = r0.getText().toString();
 
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.relaxedGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.relaxedGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton) radioButtonGroup.getChildAt(idx);
         final String textDrink = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.activityGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.activityGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
@@ -83,9 +84,9 @@ public class Update_Caffeine_Empty extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("C3");
@@ -102,10 +103,7 @@ public class Update_Caffeine_Empty extends Fragment {
         }).start();
 
 
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_limit.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_limit.java
index 758d16fbb632888595b1e5851465283b632a81ca..27797bbc9ab462c7a4ae0713943a04f0cfff8067 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_limit.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Caffeine_limit.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,19 +25,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Caffeine_limit extends Fragment {
+public class Update_Caffeine_limit extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
 
-    View updateView;
+    protected void onCreate(Bundle savedInstanceState) {
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_caffeine_limit, container, false);
 
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_caffeine_limit);
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -47,7 +47,6 @@ public class Update_Caffeine_limit extends Fragment {
 
         });
 
-        return updateView;
     }
 
 
@@ -57,7 +56,7 @@ public class Update_Caffeine_limit extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
@@ -65,21 +64,21 @@ public class Update_Caffeine_limit extends Fragment {
         final String testCompared = r0.getText().toString();
 
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.coffeeGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.coffeeGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton) radioButtonGroup.getChildAt(idx);
         final String coffee = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.sodaGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.sodaGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
         RadioButton r2 = (RadioButton) radioButtonGroup2.getChildAt(idx2);
         final String soda = r2.getText().toString();
 
-        RadioGroup radioButtonGroup3 = updateView.findViewById(R.id.energyGroup);
+        RadioGroup radioButtonGroup3 = findViewById(R.id.energyGroup);
         int radioButtonID3 = radioButtonGroup3.getCheckedRadioButtonId();
         View radioButton3 = radioButtonGroup3.findViewById(radioButtonID3);
         int idx3 = radioButtonGroup3.indexOfChild(radioButton3);
@@ -92,9 +91,9 @@ public class Update_Caffeine_limit extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("C2");
@@ -111,11 +110,7 @@ public class Update_Caffeine_limit extends Fragment {
             }
         }).start();
 
-
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Bright.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Bright.java
index b8feb66a472d822c2e6c1fa21707887fb2570304..7449322e0eac8369598b82f806874d61bbb36a95 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Bright.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Bright.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,20 +25,18 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Light_Bright extends Fragment {
+public class Update_Light_Bright extends AppCompatActivity {
 
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
 
-    View updateView;
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_light_bright, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
 
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_light_bright);
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -48,8 +48,6 @@ public class Update_Light_Bright extends Fragment {
 
         });
 
-
-        return updateView;
     }
 
     public void goToQuestionnaire(){
@@ -58,28 +56,28 @@ public class Update_Light_Bright extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.sunlightGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.sunlightGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton)  radioButtonGroup.getChildAt(idx);
         final String textSunlight = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.glassesGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.glassesGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
         RadioButton r2 = (RadioButton)  radioButtonGroup2.getChildAt(idx2);
         final String textHalf = r2.getText().toString();
 
-        RadioGroup radioButtonGroup3 = updateView.findViewById(R.id.appGroup);
+        RadioGroup radioButtonGroup3 = findViewById(R.id.appGroup);
         int radioButtonID3 = radioButtonGroup3.getCheckedRadioButtonId();
         View radioButton3 = radioButtonGroup3.findViewById(radioButtonID3);
         int idx3 = radioButtonGroup3.indexOfChild(radioButton3);
@@ -90,9 +88,9 @@ public class Update_Light_Bright extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("L1");
@@ -109,12 +107,7 @@ public class Update_Light_Bright extends Fragment {
             }
         }).start();
 
-
-
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Glasses.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Glasses.java
index cca3d776b81a0ee8e3d6681c64ed263163208f0c..ae9cdfd8121b382c7914a19f135a37476b121dab 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Glasses.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_Glasses.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,17 +25,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Light_Glasses extends Fragment {
+public class Update_Light_Glasses extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_light_glasses, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_light_glasses);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -45,7 +47,6 @@ public class Update_Light_Glasses extends Fragment {
 
         });
 
-        return updateView;
     }
 
     public void goToQuestionnaire() {
@@ -54,7 +55,7 @@ public class Update_Light_Glasses extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
@@ -62,14 +63,14 @@ public class Update_Light_Glasses extends Fragment {
         final String testCompared = r0.getText().toString();
 
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.appGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.appGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton) radioButtonGroup.getChildAt(idx);
         final String textApp = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.glassesGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.glassesGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
@@ -83,9 +84,9 @@ public class Update_Light_Glasses extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("L2");
@@ -101,9 +102,7 @@ public class Update_Light_Glasses extends Fragment {
             }
         }).start();
 
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_TurnOffBright.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_TurnOffBright.java
index c323388b0087076245c08c8186de19f42b0e6b45..236ee53873b35debb64bad57e249761f8565e2a8 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_TurnOffBright.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Light_TurnOffBright.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,18 +25,16 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Light_TurnOffBright extends Fragment {
+public class Update_Light_TurnOffBright extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_light_turnoffs, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_light_bright);
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -46,7 +46,6 @@ public class Update_Light_TurnOffBright extends Fragment {
 
         });
 
-        return updateView;
     }
 
 
@@ -56,21 +55,21 @@ public class Update_Light_TurnOffBright extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.relaxedGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.relaxedGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton) radioButtonGroup.getChildAt(idx);
         final String textTurnOff = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.activityGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.activityGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
@@ -83,9 +82,9 @@ public class Update_Light_TurnOffBright extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("L3");
@@ -101,10 +100,7 @@ public class Update_Light_TurnOffBright extends Fragment {
             }
         }).start();
 
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_7hours.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_7hours.java
index 64c3f9bf2af67d34a8a1f0d3b2cf42353ff5799f..d8cb96e89ee2b38a935ed16ea6ba6fb21c0b1acd 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_7hours.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_7hours.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -24,16 +26,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Schedule_7hours extends Fragment {
+public class Update_Schedule_7hours extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_schedule_seven, container, false);
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+    protected void onCreate(Bundle savedInstanceState) {
+
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_schedule_seven);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -47,7 +50,6 @@ public class Update_Schedule_7hours extends Fragment {
 
 
 
-        return updateView;
     }
 
     public void goToQuestionnaire(){
@@ -56,7 +58,7 @@ public class Update_Schedule_7hours extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
@@ -64,10 +66,10 @@ public class Update_Schedule_7hours extends Fragment {
         final String testCompared = r0.getText().toString();
 
 
-        final TimePicker tpLastdrink = (TimePicker) updateView.findViewById(R.id.lastDrink);
+        final TimePicker tpLastdrink = (TimePicker) findViewById(R.id.lastDrink);
         final String textSleep = tpLastdrink.getCurrentHour() + ":" + tpLastdrink.getCurrentMinute();
 
-        final TimePicker tpWhenSleep = (TimePicker) updateView.findViewById(R.id.whenSleep);
+        final TimePicker tpWhenSleep = (TimePicker) findViewById(R.id.whenSleep);
         final String textWake = tpWhenSleep.getCurrentHour() + ":" + tpWhenSleep.getCurrentMinute();
 
       //  final int dayReview = dayReviewBar.getProgress();
@@ -76,9 +78,9 @@ public class Update_Schedule_7hours extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("S2");
@@ -92,11 +94,7 @@ public class Update_Schedule_7hours extends Fragment {
 
             }
         }).start();
-
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Midnight.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Midnight.java
index 60435cbd66c8e0a002472db3b8ec97bb8703d3be..1355c19a327e494b58e2e84fc22bd45977352dce 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Midnight.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Midnight.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,16 +25,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Schedule_Midnight extends Fragment {
+public class Update_Schedule_Midnight extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_schedule_midnight, container, false);
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+    protected void onCreate(Bundle savedInstanceState) {
+
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_schedule_midnight);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -44,7 +47,6 @@ public class Update_Schedule_Midnight extends Fragment {
 
         });
 
-        return updateView;
     }
 
     public void goToQuestionnaire(){
@@ -53,14 +55,14 @@ public class Update_Schedule_Midnight extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        final TimePicker tpWhenSleep = (TimePicker) updateView.findViewById(R.id.whenSleep);
+        final TimePicker tpWhenSleep = (TimePicker) findViewById(R.id.whenSleep);
         final String textSleep = tpWhenSleep.getCurrentHour() + ":" + tpWhenSleep.getCurrentMinute();
 
      //   final int dayReview = dayReviewBar.getProgress();
@@ -69,9 +71,9 @@ public class Update_Schedule_Midnight extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("S4");
@@ -85,11 +87,7 @@ public class Update_Schedule_Midnight extends Fragment {
             }
         }).start();
 
-
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 }
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Relax.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Relax.java
index 15fb242defaf15e4ef3f84c18ae412afe7148e67..b286cc41b3f20a179f0a6c530c002562041dbdec 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Relax.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_Relax.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,17 +25,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Schedule_Relax extends Fragment {
+public class Update_Schedule_Relax extends AppCompatActivity {
    private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_schedule_relax, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_schedule_relax);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -45,7 +47,6 @@ public class Update_Schedule_Relax extends Fragment {
 
         });
 
-        return updateView;
     }
 
 
@@ -56,21 +57,21 @@ public class Update_Schedule_Relax extends Fragment {
         final String formattedDate = df.format(c);
 
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        RadioGroup radioButtonGroup = updateView.findViewById(R.id.relaxedGroup);
+        RadioGroup radioButtonGroup = findViewById(R.id.relaxedGroup);
         int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
         View radioButton = radioButtonGroup.findViewById(radioButtonID);
         int idx = radioButtonGroup.indexOfChild(radioButton);
         RadioButton r = (RadioButton) radioButtonGroup.getChildAt(idx);
         final String textRelaxed = r.getText().toString();
 
-        RadioGroup radioButtonGroup2 = updateView.findViewById(R.id.activityGroup);
+        RadioGroup radioButtonGroup2 = findViewById(R.id.activityGroup);
         int radioButtonID2 = radioButtonGroup2.getCheckedRadioButtonId();
         View radioButton2 = radioButtonGroup2.findViewById(radioButtonID2);
         int idx2 = radioButtonGroup2.indexOfChild(radioButton2);
@@ -83,9 +84,9 @@ public class Update_Schedule_Relax extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("S3");
@@ -100,12 +101,7 @@ public class Update_Schedule_Relax extends Fragment {
 
             }
         }).start();
-
-
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_SameTime.java b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_SameTime.java
index e9ae53081a8be5be2a520e83a4aa9aba5c013238..c1ba429e848b43903aa11c76b05d0401ba231684 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_SameTime.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/Update_Schedule_SameTime.java
@@ -1,11 +1,13 @@
 package com.uos.admin.sleepbetter;
 
+import android.content.Intent;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.arch.persistence.room.Room;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
+import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -24,17 +26,17 @@ import java.util.List;
 
 import static android.content.Context.MODE_PRIVATE;
 
-public class Update_Schedule_SameTime extends Fragment {
+public class Update_Schedule_SameTime extends AppCompatActivity {
     private static final String DATABASE_NAME = "user_db";
     private UserDatabase userDatabase;
-    View updateView;
 
-    @Nullable
-    @Override
-    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
-        updateView = inflater.inflate(R.layout.act_update_schedule_sametime, container, false);
+    protected void onCreate(Bundle savedInstanceState) {
 
-        Button button = (Button) updateView.findViewById(R.id.submitUpdate);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_update_schedule_sametime);
+
+        Button button = (Button) findViewById(R.id.submitUpdate);
 
         button.setOnClickListener(new View.OnClickListener() {
 
@@ -46,30 +48,6 @@ public class Update_Schedule_SameTime extends Fragment {
 
         });
 
-        /*
-        let date = Date()
-        let calendar = NSCalendar.current
-        let hour = calendar.component(.hour, from: date)
-
-
-
-        let formatter = DateFormatter()
-        formatter.dateFormat = "dd"
-        let current = formatter.string(from: date)
-        let oldDate:String = UserDefaults.standard.string(forKey: "dateStartingExperiment")!
-                let day = Int(oldDate.prefix(2))
-        if (Int(current)! -  day! == 0){
-            let alert = UIAlertController(title: "Notice", message: "You are not allowed to fill in today's questionnaire as you just changed the experiment. Come back tomorrow.", preferredStyle: UIAlertControllerStyle.alert)
-            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: returnBack))
-                self.present(alert, animated: true, completion: nil)
-
-                self.view.isUserInteractionEnabled = false
-
-        }
-        */
-
-
-        return updateView;
     }
 
 
@@ -79,17 +57,17 @@ public class Update_Schedule_SameTime extends Fragment {
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         final String formattedDate = df.format(c);
 
-        RadioGroup radioButtonGroup0 = updateView.findViewById(R.id.radioGroup2);
+        RadioGroup radioButtonGroup0 = findViewById(R.id.radioGroup2);
         int radioButtonID0 = radioButtonGroup0.getCheckedRadioButtonId();
         View radioButton0 = radioButtonGroup0.findViewById(radioButtonID0);
         int idx0 = radioButtonGroup0.indexOfChild(radioButton0);
         RadioButton r0 = (RadioButton)  radioButtonGroup0.getChildAt(idx0);
         final String testCompared = r0.getText().toString();
 
-        final TimePicker tpLastdrink = (TimePicker) updateView.findViewById(R.id.lastDrink);
+        final TimePicker tpLastdrink = (TimePicker) findViewById(R.id.lastDrink);
         final String textSleep = tpLastdrink.getCurrentHour() + ":" + tpLastdrink.getCurrentMinute();
 
-        final TimePicker tpWhenSleep = (TimePicker) updateView.findViewById(R.id.whenSleep);
+        final TimePicker tpWhenSleep = (TimePicker) findViewById(R.id.whenSleep);
         final String textWake = tpWhenSleep.getCurrentHour() + ":" + tpWhenSleep.getCurrentMinute();
 
      //   final int dayReview = dayReviewBar.getProgress();
@@ -98,9 +76,9 @@ public class Update_Schedule_SameTime extends Fragment {
             @Override
             public void run() {
 
-                userDatabase = Room.databaseBuilder(getActivity().getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
+                userDatabase = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, DATABASE_NAME).fallbackToDestructiveMigration().build();
                 UserExperiment user = new UserExperiment();
-                String username = getActivity().getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
+                String username = getApplicationContext().getSharedPreferences("name", MODE_PRIVATE).getString("username", "nothing");
                 user.setUsername(username);
                 user.setDate(formattedDate);
                 user.setExperiment("S1");
@@ -115,10 +93,7 @@ public class Update_Schedule_SameTime extends Fragment {
             }
         }).start();
 
-
-        FragmentManager fragmentManager = getFragmentManager();
-
-        fragmentManager.beginTransaction().replace(R.id.content_frame, new QFinal()).commit();
+        startActivity(new Intent(this, QFinal.class));
     }
 }
 
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/ViewPageAdapter.java b/app/src/main/java/com/uos/admin/sleepbetter/ViewPageAdapter.java
index f33f067972918a1baa5f72f54fa285f1a35bacd3..618cfbc473c97f1fa0806d256ec6bee939a3545d 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/ViewPageAdapter.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/ViewPageAdapter.java
@@ -40,4 +40,6 @@ public class ViewPageAdapter extends FragmentPagerAdapter {
         sectionsTitles.add(title);
 
     }
+
+
 }
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/WhatExperiments.java b/app/src/main/java/com/uos/admin/sleepbetter/WhatExperiments.java
index 5b439b3259ee396b95a8fc52b5270fdb73df8bbe..df68857dd06f2e09a897561604332c9773fbfa8b 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/WhatExperiments.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/WhatExperiments.java
@@ -1,25 +1,25 @@
 package com.uos.admin.sleepbetter;
 
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageView;
+import android.widget.TextView;
+
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 public class WhatExperiments extends AppCompatActivity {
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.act_what_experiments);
 
-       ImageView imageView = findViewById(R.id.imageView23);
-        imageView.setImageResource(R.drawable.data);
-
-         imageView = findViewById(R.id.imageView24);
-        imageView.setImageResource(R.drawable.data);
-
         Button button = (Button) findViewById(R.id.back);
 
         button.setOnClickListener(new View.OnClickListener() {
@@ -31,6 +31,16 @@ public class WhatExperiments extends AppCompatActivity {
             }
 
         });
+        TextView fo = findViewById(R.id.textView6);
+        fo.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView fo2 = findViewById(R.id.textView9);
+        fo2.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView fo3 = findViewById(R.id.textView7);
+        fo3.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+        TextView fo4 = findViewById(R.id.textView5);
+        fo4.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
     }
 
     private void goToThirdActivity() {
diff --git a/app/src/main/java/com/uos/admin/sleepbetter/WhatIsSleep.java b/app/src/main/java/com/uos/admin/sleepbetter/WhatIsSleep.java
index ecc06005c664b5579ca249f848d913a146cd625f..14ad50d195d997407a4bea7f05295675d6861017 100644
--- a/app/src/main/java/com/uos/admin/sleepbetter/WhatIsSleep.java
+++ b/app/src/main/java/com/uos/admin/sleepbetter/WhatIsSleep.java
@@ -1,25 +1,25 @@
 package com.uos.admin.sleepbetter;
 
 import android.content.Intent;
+import android.os.Build;
+import android.support.annotation.RequiresApi;
 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageView;
+import android.widget.TextView;
+
+import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
 
 public class WhatIsSleep extends AppCompatActivity {
 
+    @RequiresApi(api = Build.VERSION_CODES.O)
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.act_what_is_sleep);
 
-        ImageView imageView = findViewById(R.id.imageView4);
-        imageView.setImageResource(R.drawable.data);
-
-        imageView = findViewById(R.id.imageView5);
-        imageView.setImageResource(R.drawable.data);
-
         Button button = (Button) findViewById(R.id.back);
 
         button.setOnClickListener(new View.OnClickListener() {
@@ -31,6 +31,16 @@ public class WhatIsSleep extends AppCompatActivity {
             }
 
         });
+
+
+        TextView fo = findViewById(R.id.textView6);
+        fo.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView fo2 = findViewById(R.id.textView7);
+        fo2.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
+
+        TextView fo3 = findViewById(R.id.textView5);
+        fo3.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
     }
     private void goToThirdActivity() {
 
diff --git a/app/src/main/res/layout/act_consent.xml b/app/src/main/res/layout/act_consent.xml
index a72877b84131ce05e569ffb455edbd14a6658675..56991e038281bf02ee85784ab43860c9b90ffe00 100644
--- a/app/src/main/res/layout/act_consent.xml
+++ b/app/src/main/res/layout/act_consent.xml
@@ -36,6 +36,7 @@
             android:layout_marginEnd="8dp"
             android:maxLines="5"
             android:text="@string/consentIntro"
+            android:textAlignment="viewStart"
             android:textColor="@android:color/black"
             app:autoSizeTextType="uniform"
             app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/act_current_xperiment.xml b/app/src/main/res/layout/act_current_xperiment.xml
index 742f21552e31a0101ee5c6ede3f47178b6be2cd5..0d526b8fb5b16b870064d10e9b2b0b39980eb5d2 100644
--- a/app/src/main/res/layout/act_current_xperiment.xml
+++ b/app/src/main/res/layout/act_current_xperiment.xml
@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".FirstPage">
+    tools:context=".MyCurrentExperiment">
 
     <TextView
         android:id="@+id/welcomeTitle"
@@ -36,25 +36,28 @@
 
     <TextView
         android:id="@+id/descriptionID"
-        android:layout_width="408dp"
-        android:layout_height="360dp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
         android:layout_marginTop="20dp"
+        android:layout_marginEnd="16dp"
         android:maxLines="30"
         android:text="Since you haven't chosen an experiment from the &quot;Experiment&quot; section yet, this section is unavailable."
         android:textAlignment="center"
         android:textColor="@android:color/black"
-        android:textSize="14sp"
+        android:textSize="12sp"
         app:autoSizeTextType="uniform"
-        app:layout_constraintHorizontal_bias="0.0"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/welcomeTo3" />
 
     <TextView
         android:id="@+id/welcomeTo3"
-        android:layout_width="406dp"
+        android:layout_width="0dp"
         android:layout_height="27dp"
+        android:layout_marginLeft="8dp"
         android:layout_marginTop="40dp"
+        android:layout_marginRight="8dp"
         android:maxLines="30"
         android:text="The experiment presumes:"
         android:textAlignment="center"
@@ -68,9 +71,11 @@
 
     <TextView
         android:id="@+id/experimentTitleID"
-        android:layout_width="393dp"
-        android:layout_height="44dp"
+        android:layout_width="359dp"
+        android:layout_height="29dp"
+        android:layout_marginLeft="8dp"
         android:layout_marginTop="36dp"
+        android:layout_marginRight="8dp"
         android:maxLines="30"
         android:text="NO CHOSEN EXPERIMENT"
         android:textAlignment="center"
@@ -78,7 +83,7 @@
         android:textSize="14sp"
         android:textStyle="bold"
         app:autoSizeTextType="uniform"
-        app:layout_constraintHorizontal_bias="0.111"
+        app:layout_constraintHorizontal_bias="0.491"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/welcomeTitle" />
diff --git a/app/src/main/res/layout/act_data.xml b/app/src/main/res/layout/act_data.xml
index e9f89524938559c3b6851c6d4654f5f110094143..7eaa7941c325f676d407a48dbcf3cd5f7540a338 100644
--- a/app/src/main/res/layout/act_data.xml
+++ b/app/src/main/res/layout/act_data.xml
@@ -202,6 +202,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="20dp"
+                    android:background="#3700BCD4"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintHorizontal_bias="0.0"
                     app:layout_constraintStart_toStartOf="parent"
@@ -266,15 +267,15 @@
                 <TextView
                     android:id="@+id/experimentName"
                     android:layout_width="wrap_content"
-                    android:layout_height="20dp"
+                    android:layout_height="40dp"
                     android:layout_marginStart="8dp"
-                    android:maxLines="5"
-                    app:autoSizeTextType="uniform"
                     android:layout_marginTop="8dp"
+                    android:maxLines="5"
                     android:text="@string/svdExperiment"
                     android:textColor="@android:color/holo_blue_dark"
                     android:textSize="12sp"
                     android:textStyle="bold"
+                    app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="@+id/infoRatings"
                     app:layout_constraintStart_toStartOf="@+id/singleVD"
                     app:layout_constraintTop_toBottomOf="@+id/singleVD" />
diff --git a/app/src/main/res/layout/act_demograpics.xml b/app/src/main/res/layout/act_demograpics.xml
index bf82c047fdbf74b31c9b00844b824edf63120425..c85ab0254b2a549a860dc2b718961a08b14286db 100644
--- a/app/src/main/res/layout/act_demograpics.xml
+++ b/app/src/main/res/layout/act_demograpics.xml
@@ -5,7 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@android:color/white"
-    tools:context=".SecondPage">
+    tools:context=".Demographics">
 
     <TextView
         android:id="@+id/textView4"
@@ -63,23 +63,14 @@
                 tools:layout_editor_absoluteX="8dp"
                 tools:layout_editor_absoluteY="0dp">
 
-                <EditText
+                <TextView
                     android:id="@+id/firstSet"
                     android:layout_width="match_parent"
                     android:layout_height="160dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/surveyDesc"
-                    android:textSize="12sp"
-                    android:textStyle="bold"
+                    android:textColor="#000000"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/act_diary.xml b/app/src/main/res/layout/act_diary.xml
index bf79e8b6dcf3db52ec11eb3acd0d0b7a195cdbb1..116f9aef2a5b61863bb572d50f423619463bafbe 100644
--- a/app/src/main/res/layout/act_diary.xml
+++ b/app/src/main/res/layout/act_diary.xml
@@ -14,22 +14,14 @@
         android:layout_height="match_parent"
         tools:context=".ThirdPage">
 
-        <EditText
+        <TextView
             android:id="@+id/pleaseInput"
             android:layout_width="match_parent"
             android:layout_height="80dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
-            android:background="@android:color/transparent"
-            android:clickable="false"
-            android:cursorVisible="false"
-            android:ems="10"
-            android:focusable="false"
-            android:focusableInTouchMode="false"
-            android:hint="@string/some_explanation_about_the_input"
-            android:inputType=""
-            android:maxLines="5"
+            android:textColor="@color/black"
             android:text="@string/goalDiaryIntro"
             android:textSize="16sp"
             android:textStyle="italic"
@@ -47,7 +39,8 @@
             android:layout_marginTop="16dp"
             android:background="@drawable/text_input_border"
             android:hint="@string/goalDiaryInput"
-            android:inputType=""
+            android:inputType="text"
+            android:imeOptions="actionDone"
             android:textSize="14sp"
             android:textStyle="italic"
             app:layout_constraintEnd_toEndOf="@+id/pleaseInput"
diff --git a/app/src/main/res/layout/act_main_menu.xml b/app/src/main/res/layout/act_main_menu.xml
index 886b08180fa89a80a644c0e560979076c9268f41..92febfdf911becc90e79db2d37aed2463200cbd5 100644
--- a/app/src/main/res/layout/act_main_menu.xml
+++ b/app/src/main/res/layout/act_main_menu.xml
@@ -11,8 +11,10 @@
     <android.support.v7.widget.Toolbar
         android:id="@+id/toolbar_id"
         android:layout_width="match_parent"
-        android:layout_height="?attr/actionBarSize"
-        android:background="@color/toolbarColor"
+        android:layout_height="36dp"
+        android:background="@color/toolbarColorUp"
+        android:minHeight="36dp"
+        app:maxButtonHeight="36dp"
         app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
 
     <android.support.design.widget.TabLayout
diff --git a/app/src/main/res/layout/act_menu.xml b/app/src/main/res/layout/act_menu.xml
index 9fb1022883177c6ed0f32ff8c7dcd5ab07e4057b..afae6e1e9b305de3348a84fdec49e5ce20221a83 100644
--- a/app/src/main/res/layout/act_menu.xml
+++ b/app/src/main/res/layout/act_menu.xml
@@ -11,8 +11,8 @@
 
         <ImageView
             android:id="@+id/imageView"
-            android:layout_width="256dp"
-            android:layout_height="144dp"
+            android:layout_width="196dp"
+            android:layout_height="84dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="13dp"
             android:layout_marginEnd="8dp"
@@ -25,8 +25,7 @@
             android:id="@+id/whatSleep"
             android:layout_width="139dp"
             android:layout_height="15dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:background="@drawable/rounded_button_one"
             android:text="@string/settingsTitle"
             android:textColor="@android:color/white"
@@ -37,9 +36,9 @@
         <Button
             android:id="@+id/whatSleep2"
             android:layout_width="241dp"
-            android:layout_height="44dp"
+            android:layout_height="28dp"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:background="@drawable/rounded_button_one"
             android:text="@string/firstOptionMainMenu"
@@ -51,9 +50,9 @@
         <Button
             android:id="@+id/whatSleep3"
             android:layout_width="241dp"
-            android:layout_height="44dp"
+            android:layout_height="24dp"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:background="@drawable/rounded_button_one"
             android:text="My Experiment"
@@ -66,7 +65,7 @@
         <Button
             android:id="@+id/WhatExperiments"
             android:layout_width="244dp"
-            android:layout_height="38dp"
+            android:layout_height="28dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
@@ -82,7 +81,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="24dp"
+            android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:text="@string/introUp"
             android:textColor="@android:color/holo_red_dark"
@@ -98,7 +97,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:text="@string/introUpsub"
             android:textColor="@android:color/holo_blue_dark"
@@ -111,9 +110,10 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:layout_marginEnd="8dp"
             android:text="You have 2 days left of the current experiment."
+            android:textAlignment="center"
             android:textColor="#000000"
             android:textSize="8sp"
             app:layout_constraintEnd_toEndOf="parent"
@@ -123,32 +123,35 @@
         <ImageView
             android:id="@+id/imageView2"
             android:layout_width="127dp"
-            android:layout_height="92dp"
+            android:layout_height="62dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
             app:srcCompat="@drawable/pillow" />
 
-        <EditText
+        <TextView
             android:id="@+id/editText3"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
+            android:layout_marginStart="4dp"
+            android:layout_marginTop="16dp"
+            android:clickable="false"
             android:ems="10"
-            android:inputType="textPersonName"
+            android:inputType="none"
             android:text="George Catalin Muresan"
+            android:textColor="#000000"
+            android:textSize="18sp"
+            android:textStyle="bold"
             app:layout_constraintStart_toEndOf="@+id/imageView2"
             app:layout_constraintTop_toTopOf="parent" />
 
         <View
             android:id="@+id/view"
-            android:layout_width="382dp"
+            android:layout_width="0dp"
             android:layout_height="2dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
             android:background="@color/black"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -160,7 +163,7 @@
             android:layout_height="0dp"
             android:layout_marginStart="8dp"
             android:layout_marginBottom="8dp"
-            android:text="Participant ID: "
+            android:text="User ID: "
             android:textAlignment="center"
             android:textColor="#000000"
             app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/layout/act_ques_final.xml b/app/src/main/res/layout/act_ques_final.xml
index b85a280d91cf0128fb4df04b1c8ac150a8c71889..cc27421a8d01a9df94066ae1f8dbbdd244ea4de1 100644
--- a/app/src/main/res/layout/act_ques_final.xml
+++ b/app/src/main/res/layout/act_ques_final.xml
@@ -5,7 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@android:color/white"
-    tools:context=".Qfinal">
+    tools:context=".QFinal">
 
     <TextView
         android:id="@+id/questionnaireTitle"
@@ -63,46 +63,30 @@
                 tools:layout_editor_absoluteX="8dp"
                 tools:layout_editor_absoluteY="0dp">
 
-                <EditText
+                <TextView
                     android:id="@+id/firstSet"
                     android:layout_width="match_parent"
                     android:layout_height="70dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q1desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
-                <EditText
+                <TextView
                     android:id="@+id/secondSet"
                     android:layout_width="match_parent"
                     android:layout_height="70dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q2desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
@@ -110,23 +94,15 @@
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/q3Group" />
 
-                <EditText
+                <TextView
                     android:id="@+id/thirdSet"
                     android:layout_width="match_parent"
                     android:layout_height="90dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q3desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/act_ques_initial.xml b/app/src/main/res/layout/act_ques_initial.xml
index ef67498cd2baa7e93fabda940959053547f5d053..1e0ae4bad7c766d196b0e16bff2be3c547ea24ce 100644
--- a/app/src/main/res/layout/act_ques_initial.xml
+++ b/app/src/main/res/layout/act_ques_initial.xml
@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".SecondPage">
+    tools:context=".QInitial">
 
     <TextView
         android:id="@+id/questionnaireTitle"
@@ -62,46 +62,30 @@
                 tools:layout_editor_absoluteX="8dp"
                 tools:layout_editor_absoluteY="0dp">
 
-                <EditText
+                <TextView
                     android:id="@+id/firstSet"
                     android:layout_width="match_parent"
-                    android:layout_height="70dp"
+                    android:layout_height="50dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q1desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
-                <EditText
+                <TextView
                     android:id="@+id/secondSet"
                     android:layout_width="match_parent"
-                    android:layout_height="70dp"
+                    android:layout_height="50dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q2desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
@@ -109,23 +93,15 @@
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/q3Group" />
 
-                <EditText
+                <TextView
                     android:id="@+id/thirdSet"
                     android:layout_width="match_parent"
-                    android:layout_height="90dp"
+                    android:layout_height="80dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q3desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
@@ -133,23 +109,15 @@
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/q5Group" />
 
-                <EditText
+                <TextView
                     android:id="@+id/fourthSet"
                     android:layout_width="match_parent"
-                    android:layout_height="90dp"
+                    android:layout_height="70dp"
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="8dp"
                     android:layout_marginEnd="8dp"
-                    android:clickable="false"
-                    android:cursorVisible="false"
-                    android:ems="10"
-                    android:focusable="false"
-                    android:focusableInTouchMode="false"
-                    android:hint="@string/some_explanation_about_the_input"
-                    android:inputType="textMultiLine"
-                    android:maxLines="30"
                     android:text="@string/q4desc"
-                    android:textSize="12sp"
+                    android:textColor="#000000"
                     android:textStyle="bold"
                     app:autoSizeTextType="uniform"
                     app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/act_settings.xml b/app/src/main/res/layout/act_settings.xml
index 4753e532c3f1f6179651157d404ef8f9f6ebce40..d94cecbda31655ba5d50d490aa0799f9a684540c 100644
--- a/app/src/main/res/layout/act_settings.xml
+++ b/app/src/main/res/layout/act_settings.xml
@@ -46,8 +46,8 @@
 
                 <android.support.constraint.ConstraintLayout
                     android:layout_width="match_parent"
-                    android:layout_height="1080dp"
-                    tools:context=".FirstPage">
+                    android:layout_height="1120dp"
+                    tools:context=".Settings">
 
                     <Button
                         android:id="@+id/submitButton"
@@ -81,7 +81,8 @@
                         android:layout_marginTop="16dp"
                         android:background="@drawable/text_input_border"
                         android:hint="@string/name"
-                        android:inputType=""
+                        android:inputType="text"
+                        android:imeOptions="actionDone"
                         android:textSize="18sp"
                         android:textStyle="italic"
                         app:layout_constraintEnd_toEndOf="parent"
@@ -122,9 +123,11 @@
 
                     <TextView
                         android:id="@+id/welcomeTo2"
-                        android:layout_width="365dp"
+                        android:layout_width="0dp"
                         android:layout_height="42dp"
+                        android:layout_marginLeft="8dp"
                         android:layout_marginTop="4dp"
+                        android:layout_marginRight="8dp"
                         android:maxLines="20"
                         android:text="We highly recommend filling in the questionnaire at the end of the day and NOT the day/morning after."
                         android:textAlignment="viewStart"
@@ -135,6 +138,21 @@
                         app:layout_constraintRight_toRightOf="parent"
                         app:layout_constraintTop_toBottomOf="@+id/textView14" />
 
+                    <TextView
+                        android:id="@+id/exp"
+                        android:layout_width="0dp"
+                        android:layout_height="36dp"
+                        android:layout_marginLeft="8dp"
+                        android:layout_marginTop="8dp"
+                        android:layout_marginRight="8dp"
+                        android:maxLines="30"
+                        android:text="Current experiment."
+                        android:textColor="@android:color/black"
+                        app:layout_constraintHorizontal_bias="0.491"
+                        app:layout_constraintLeft_toLeftOf="parent"
+                        app:layout_constraintRight_toRightOf="parent"
+                        app:layout_constraintTop_toBottomOf="@+id/expTitle" />
+
                     <TextView
                         android:id="@+id/welcomeTo4"
                         android:layout_width="123dp"
@@ -155,7 +173,7 @@
                         android:id="@+id/welcomeTo6"
                         android:layout_width="123dp"
                         android:layout_height="19dp"
-                        android:layout_marginTop="320dp"
+                        android:layout_marginTop="8dp"
                         android:maxLines="20"
                         android:text="Notification settings"
                         android:textAlignment="viewStart"
@@ -165,13 +183,13 @@
                         app:layout_constraintHorizontal_bias="0.035"
                         app:layout_constraintLeft_toLeftOf="parent"
                         app:layout_constraintRight_toRightOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/textView14" />
+                        app:layout_constraintTop_toBottomOf="@+id/lastDrink3" />
 
                     <TextView
                         android:id="@+id/welcomeTo5"
                         android:layout_width="123dp"
                         android:layout_height="19dp"
-                        android:layout_marginTop="120dp"
+                        android:layout_marginTop="8dp"
                         android:maxLines="20"
                         android:text="Until"
                         android:textAlignment="viewStart"
@@ -181,7 +199,7 @@
                         app:layout_constraintHorizontal_bias="0.035"
                         app:layout_constraintLeft_toLeftOf="parent"
                         app:layout_constraintRight_toRightOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/textView14" />
+                        app:layout_constraintTop_toBottomOf="@+id/textView11" />
 
                     <TextView
                         android:id="@+id/welcomeTitle"
@@ -215,7 +233,7 @@
                         app:layout_constraintTop_toBottomOf="@+id/welcomeTitle" />
 
                     <TextView
-                        android:id="@+id/textView11"
+                        android:id="@+id/expTitle"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_marginTop="28dp"
@@ -233,7 +251,7 @@
                         android:id="@+id/textView13"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_marginTop="164dp"
+                        android:layout_marginTop="8dp"
                         android:text="Notification Settings"
                         android:textAlignment="viewStart"
                         android:textColor="#000000"
@@ -241,7 +259,7 @@
                         app:layout_constraintEnd_toEndOf="parent"
                         app:layout_constraintHorizontal_bias="0.041"
                         app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/welcomeTitle" />
+                        app:layout_constraintTop_toBottomOf="@+id/exp" />
 
                     <TextView
                         android:id="@+id/textView14"
@@ -262,7 +280,7 @@
                         android:id="@+id/textView11"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_marginTop="132dp"
+                        android:layout_marginTop="8dp"
                         android:text="7 PM"
                         android:textAlignment="viewStart"
                         android:textColor="#000000"
@@ -271,7 +289,7 @@
                         app:layout_constraintEnd_toEndOf="parent"
                         app:layout_constraintHorizontal_bias="0.026"
                         app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/lastDrink2" />
+                        app:layout_constraintTop_toBottomOf="@+id/welcomeTo4" />
 
                     <TimePicker
                         android:id="@+id/lastDrink2"
diff --git a/app/src/main/res/layout/act_update_schedule_sametime.xml b/app/src/main/res/layout/act_update_schedule_sametime.xml
index 7f91a48843f97ddd33245b1472415115678f3edb..a992c29e73c3c9bd8476d0e69dfa0d2b64c6e363 100644
--- a/app/src/main/res/layout/act_update_schedule_sametime.xml
+++ b/app/src/main/res/layout/act_update_schedule_sametime.xml
@@ -46,10 +46,9 @@
             style="@android:style/Widget.Material.ScrollView"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginBottom="8dp"
-            android:layout_marginEnd="8dp"
             android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
+            android:layout_marginEnd="8dp"
+            android:layout_marginBottom="8dp"
             android:fillViewport="true"
             android:scrollbarStyle="insideOverlay"
             android:visibility="visible"
@@ -64,12 +63,12 @@
                 android:id="@+id/FrameForScrollView"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginBottom="8dp"
-                android:layout_marginEnd="8dp"
-                android:layout_marginLeft="8dp"
-                android:layout_marginRight="8dp"
                 android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
                 android:layout_marginTop="8dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="8dp"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintEnd_toEndOf="@+id/ScrollViewQuestionnaire"
                 app:layout_constraintStart_toStartOf="@+id/ScrollViewQuestionnaire"
@@ -83,33 +82,43 @@
                     tools:layout_editor_absoluteY="0dp">
 
 
-                    <TextView
-                        android:id="@+id/appGroup"
+                    <Button
+                        android:id="@+id/submitUpdate"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginStart="8dp"
+                        android:layout_marginTop="16dp"
+                        android:layout_marginEnd="8dp"
+                        android:text="@string/nextButton"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toBottomOf="@+id/imageView13" />
+
+                    <EditText
+                        android:id="@+id/loggngTitle"
                         android:layout_width="match_parent"
-                        android:layout_height="36dp"
+                        android:layout_height="wrap_content"
                         android:layout_marginStart="8dp"
                         android:layout_marginTop="8dp"
                         android:layout_marginEnd="8dp"
-                        android:background="@android:color/transparent"
                         android:clickable="false"
+                        android:cursorVisible="false"
                         android:ems="10"
                         android:focusable="false"
                         android:focusableInTouchMode="false"
                         android:hint="@string/some_explanation_about_the_input"
-                        android:inputType=""
-                        android:text="@string/whenWakeQuestion"
-                        android:textColor="@android:color/black"
+                        android:inputType="textPersonName"
+                        android:text="@string/logging"
                         app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintHorizontal_bias="0.111"
+                        app:layout_constraintHorizontal_bias="0.0"
                         app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/lastDrink" />
+                        app:layout_constraintTop_toBottomOf="@+id/radioGroup2" />
 
                     <EditText
-                        android:id="@+id/loggngTitle"
+                        android:id="@+id/dayReview"
                         android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
+                        android:layout_height="50dp"
                         android:layout_marginStart="8dp"
-                        android:layout_marginTop="8dp"
                         android:layout_marginEnd="8dp"
                         android:clickable="false"
                         android:cursorVisible="false"
@@ -118,11 +127,22 @@
                         android:focusableInTouchMode="false"
                         android:hint="@string/some_explanation_about_the_input"
                         android:inputType="textPersonName"
-                        android:text="@string/logging"
+                        android:text="@string/dayReview"
                         app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintHorizontal_bias="0.0"
                         app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/radioGroup2" />
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <ImageView
+                        android:id="@+id/imageView13"
+                        android:layout_width="321dp"
+                        android:layout_height="132dp"
+                        android:layout_marginStart="16dp"
+                        android:layout_marginTop="16dp"
+                        android:layout_marginEnd="16dp"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toBottomOf="@+id/whenSleep"
+                        app:srcCompat="@drawable/alarm1" />
 
                     <RadioGroup
                         android:id="@+id/radioGroup2"
@@ -171,23 +191,26 @@
                             android:text="@string/op5.6" />
                     </RadioGroup>
 
-                    <EditText
-                        android:id="@+id/dayReview"
+                    <TextView
+                        android:id="@+id/appGroup"
                         android:layout_width="match_parent"
-                        android:layout_height="50dp"
+                        android:layout_height="36dp"
                         android:layout_marginStart="8dp"
+                        android:layout_marginTop="8dp"
                         android:layout_marginEnd="8dp"
+                        android:background="@android:color/transparent"
                         android:clickable="false"
-                        android:cursorVisible="false"
                         android:ems="10"
                         android:focusable="false"
                         android:focusableInTouchMode="false"
                         android:hint="@string/some_explanation_about_the_input"
-                        android:inputType="textPersonName"
-                        android:text="@string/dayReview"
+                        android:inputType=""
+                        android:text="@string/whenWakeQuestion"
+                        android:textColor="@android:color/black"
                         app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintHorizontal_bias="0.111"
                         app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toTopOf="parent" />
+                        app:layout_constraintTop_toBottomOf="@+id/lastDrink" />
 
                     <TextView
                         android:id="@+id/questionDay"
@@ -231,18 +254,6 @@
                         app:layout_constraintStart_toStartOf="parent"
                         app:layout_constraintTop_toBottomOf="@+id/loggngTitle" />
 
-                    <Button
-                        android:id="@+id/submitUpdate"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginStart="8dp"
-                        android:layout_marginTop="16dp"
-                        android:layout_marginEnd="8dp"
-                        android:text="@string/nextButton"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/imageView13" />
-
                     <TimePicker
                         android:id="@+id/lastDrink"
                         android:layout_width="match_parent"
@@ -267,18 +278,6 @@
                         app:layout_constraintStart_toStartOf="parent"
                         app:layout_constraintTop_toBottomOf="@+id/appGroup" />
 
-                    <ImageView
-                        android:id="@+id/imageView13"
-                        android:layout_width="321dp"
-                        android:layout_height="132dp"
-                        android:layout_marginStart="16dp"
-                        android:layout_marginTop="16dp"
-                        android:layout_marginEnd="16dp"
-                        app:layout_constraintEnd_toEndOf="parent"
-                        app:layout_constraintStart_toStartOf="parent"
-                        app:layout_constraintTop_toBottomOf="@+id/whenSleep"
-                        app:srcCompat="@drawable/alarm1" />
-
 
                 </android.support.constraint.ConstraintLayout>
             </FrameLayout>
diff --git a/app/src/main/res/layout/act_welcome.xml b/app/src/main/res/layout/act_welcome.xml
index e69c47d3013efefd5daa7c1e247fd1c4f20120d8..3c523382f3b04fa5782e24ce1465ba36f0e09c67 100644
--- a/app/src/main/res/layout/act_welcome.xml
+++ b/app/src/main/res/layout/act_welcome.xml
@@ -28,7 +28,7 @@
         android:layout_height="27dp"
         android:layout_marginTop="16dp"
         android:maxLines="20"
-        android:text="Participant ID:"
+        android:text="User ID:"
         android:textAlignment="center"
         android:textColor="@android:color/black"
         android:textSize="14sp"
@@ -87,9 +87,10 @@
         android:layout_marginTop="20dp"
         android:background="@drawable/text_input_border"
         android:hint="@string/name"
-        android:inputType=""
         android:textSize="18sp"
         android:textStyle="italic"
+        android:inputType="text"
+        android:imeOptions="actionDone"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/consentForm" />
diff --git a/app/src/main/res/layout/act_what_is_sleep.xml b/app/src/main/res/layout/act_what_is_sleep.xml
index 7d566d6a5b12f64545c8c9eaecbcb8d6dc43bc55..1e996ec58c1faf661934b3e7d58a731f5e08913a 100644
--- a/app/src/main/res/layout/act_what_is_sleep.xml
+++ b/app/src/main/res/layout/act_what_is_sleep.xml
@@ -163,7 +163,8 @@
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toEndOf="@+id/textView6"
                     app:layout_constraintTop_toBottomOf="@+id/sleepHygieneTitle"
-                    app:srcCompat="@drawable/owl" />
+                    app:srcCompat="@drawable/owl"
+                    tools:srcCompat="@drawable/owl" />
 
                 <ImageView
                     android:id="@+id/imageView5"
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 7e711f696baa2eb4bec5419bafd09867decd10d7..92ad843e3ffdb30b77fb98085e57206a6247ce0b 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -4,5 +4,7 @@
     <color name="colorPrimaryDark">#2E3A91</color>
     <color name="colorAccent">#FF4081</color>
     <color name="toolbarColor">#5A9DEC</color>
+    <color name="toolbarColorUp">#32467E</color>
     <color name="black">#000000</color>
+    <color name="LightSteelBlue">#b0c4de</color>
 </resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1c8c1577789d0aa4e38369bf483a5005b022b93b..6a3a79c08139dbb02ba4e9c775b6453eab5cd791 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -10,13 +10,13 @@
     <string name="startButton">START</string>
     <string name="permission">Consent Form</string>
     <string name="yourName">Your name...</string>
-    <string name="participantName">Participant ID...</string>
+    <string name="participantName">User ID...</string>
     <string name="linkBitmoji">Linked Bitmoji</string>
 
     <string name="consentPageTitle">CONSENT FORM</string>
     <string name="consentIntro">In order to proceed with the experiment, we will kindly ask you to look over the next paragraphs to understand your involvement into this study. Please initial the box(es) if you agree with the statement(s):
 </string>
-    <string name="permissionOne">I have read and understood the information sheet (26/11/2018 /Version 2.0) and have had the opportunity to ask questions about the study.</string>
+    <string name="permissionOne">I have read and understood the information sheet (18/12/2018 /Version 3.0) and have had the opportunity to ask questions about the study.</string>
     <string name="permissionTwo">I agree to take part in this research project and agree for my data to be used for the purpose of this study.</string>
     <string name="permissionThree">I understand my participation is voluntary and I may withdraw at any time for any reason without my rights being affected.</string>
     <string name="permissionFour">I understand my responses will be anonymised in reports of the research.</string>
@@ -133,7 +133,7 @@
     <string name="desc">Description</string>
     <string name="goalDiaryInput">Goal Diary Input...</string>
     <string name="name">Your Name...</string>
-    <string name="participant">Participant ID...</string>
+    <string name="participant">User ID...</string>
     <string name="firstNoteHint">*First Note*</string>
 
     <string name="title_activity_main_page">MainPage</string>
@@ -193,7 +193,7 @@
     <string name="persInputSchedule"> </string>
 
 
-    <string name="goalDiaryIntro">Welcome to your Goal Diary! Here you will able to note any particular changes you want to reflect on/any goals you wish to accomplice and any other observations. You can also see previous notes.</string>
+    <string name="goalDiaryIntro">Welcome to your Goal Diary! Here you will able to note any particular changes you want to reflect on/any goals you wish to accomplish and any other observations. You can also see previous notes.</string>
     <string name="previousGoals">Today\'s notes</string>
 
     <string name="moreInfo">More Information</string>
@@ -302,7 +302,7 @@
 
     <string name="appIntro">Welcome! Sleep Better is a mobile application that guides you through a series of experiments that you can run in a definite period of time in order to start a tuning process over your sleeping patterns.
 You will be able to change/choose your experiment once every 5 days, where (if you\'re in group A) at the end of each day you will have to log on your experience and analyse the data and interact with the other features of the app.
-To begin with, complete the consent form, input your name (that only YOU will be able to see), and your given participant number.
+To begin with, complete the consent form and input your name (that only YOU will be able to see).
 </string>
 
     <string name="ourMissionTitle">Our mission?</string>
diff --git a/libs/apache-mime4j-0.6.1.jar b/libs/apache-mime4j-0.6.1.jar
new file mode 100644
index 0000000000000000000000000000000000000000..e0f5aa649a36872e2528d87ee7304137439c1c25
Binary files /dev/null and b/libs/apache-mime4j-0.6.1.jar differ
diff --git a/libs/httpmime-4.0.1.jar b/libs/httpmime-4.0.1.jar
new file mode 100644
index 0000000000000000000000000000000000000000..c27df785b89b0b8cd10ca8b9115070d9e6b98e4c
Binary files /dev/null and b/libs/httpmime-4.0.1.jar differ