Make the app pretty.
diff --git a/res/anim/leftside_move_leftside.xml b/res/anim/leftside_move_leftside.xml
new file mode 100644
index 0000000..411b6f9
--- /dev/null
+++ b/res/anim/leftside_move_leftside.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+
+   <translate
+        android:fromXDelta="0%p"
+        android:toXDelta="-19%p"
+        android:duration="800" />
+</set>
\ No newline at end of file
diff --git a/res/anim/leftside_move_rightside.xml b/res/anim/leftside_move_rightside.xml
new file mode 100644
index 0000000..ae45492
--- /dev/null
+++ b/res/anim/leftside_move_rightside.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+    <translate
+        android:duration="800"
+        android:fromXDelta="0%p"
+        android:toXDelta="19%p" >
+    </translate>
+</set>
\ No newline at end of file
diff --git a/res/anim/move.xml b/res/anim/move.xml
new file mode 100644
index 0000000..87229e0
--- /dev/null
+++ b/res/anim/move.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+
+   <translate
+        android:fromXDelta="0%p"
+        android:toXDelta="35%p"
+        android:duration="800" />
+</set>
\ No newline at end of file
diff --git a/res/anim/move_right_leftside.xml b/res/anim/move_right_leftside.xml
new file mode 100644
index 0000000..1fd0e68
--- /dev/null
+++ b/res/anim/move_right_leftside.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+    <translate
+        android:duration="800"
+        android:fromXDelta="0%p"
+        android:toXDelta="-12%p" >
+    </translate>
+</set>
\ No newline at end of file
diff --git a/res/anim/move_right_rightside.xml b/res/anim/move_right_rightside.xml
new file mode 100644
index 0000000..8686ff9
--- /dev/null
+++ b/res/anim/move_right_rightside.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+    <translate
+        android:duration="800"
+        android:fromXDelta="0%p"
+        android:toXDelta="12%p" >
+    </translate>
+</set>
\ No newline at end of file
diff --git a/res/anim/slide_in_left.xml b/res/anim/slide_in_left.xml
new file mode 100644
index 0000000..249a201
--- /dev/null
+++ b/res/anim/slide_in_left.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/linear_interpolator"
+    android:fillAfter="false">
+    <translate
+        android:duration="800"
+        android:fromXDelta="0%p"
+        android:toXDelta="-35%p" >
+    </translate>
+</set>
\ No newline at end of file
diff --git a/res/anim/slide_in_right.xml b/res/anim/slide_in_right.xml
new file mode 100644
index 0000000..c01693f
--- /dev/null
+++ b/res/anim/slide_in_right.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android" >
+    <translate
+        android:duration="600"
+        android:fromXDelta="-100%"
+        android:toXDelta="0%" >
+    </translate>
+</set>
\ No newline at end of file
diff --git a/res/drawable/endo_medium_back_full_regular_1.png b/res/drawable/endo_medium_back_full_regular_1.png
new file mode 100644
index 0000000..db37a51
--- /dev/null
+++ b/res/drawable/endo_medium_back_full_regular_1.png
Binary files differ
diff --git a/res/drawable/endo_medium_back_mask_middle_regular.png b/res/drawable/endo_medium_back_mask_middle_regular.png
new file mode 100644
index 0000000..e8d12b0
--- /dev/null
+++ b/res/drawable/endo_medium_back_mask_middle_regular.png
Binary files differ
diff --git a/res/drawable/endo_medium_back_mask_top_regular.png b/res/drawable/endo_medium_back_mask_top_regular.png
new file mode 100644
index 0000000..369c5b2
--- /dev/null
+++ b/res/drawable/endo_medium_back_mask_top_regular.png
Binary files differ
diff --git a/res/drawable/large.png b/res/drawable/large.png
new file mode 100644
index 0000000..f6bd4a4
--- /dev/null
+++ b/res/drawable/large.png
Binary files differ
diff --git a/res/drawable/leftdrawer_layer.xml b/res/drawable/leftdrawer_layer.xml
new file mode 100644
index 0000000..652026a
--- /dev/null
+++ b/res/drawable/leftdrawer_layer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image1" >
+      <bitmap android:src="@drawable/module_mediumscreen_back_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image1" >
+     <bitmap android:src="@drawable/module_mediumscreen_back_side_regular"
+       />
+    </item>
+</layer-list>
diff --git a/res/drawable/leftdrawer_layer1x2.xml b/res/drawable/leftdrawer_layer1x2.xml
new file mode 100644
index 0000000..7c2e962
--- /dev/null
+++ b/res/drawable/leftdrawer_layer1x2.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image1" >
+      <bitmap android:src="@drawable/module_1x2_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image1" >
+     <bitmap android:src="@drawable/module_1x2_side_regular"
+       />
+    </item>
+</layer-list>
diff --git a/res/drawable/line_leftdrawer.png b/res/drawable/line_leftdrawer.png
new file mode 100644
index 0000000..5f3ca6d
--- /dev/null
+++ b/res/drawable/line_leftdrawer.png
Binary files differ
diff --git a/res/drawable/lock_closed_black.png b/res/drawable/lock_closed_black.png
new file mode 100644
index 0000000..5fec8af
--- /dev/null
+++ b/res/drawable/lock_closed_black.png
Binary files differ
diff --git a/res/drawable/lock_closed_green.png b/res/drawable/lock_closed_green.png
new file mode 100644
index 0000000..1684d06
--- /dev/null
+++ b/res/drawable/lock_closed_green.png
Binary files differ
diff --git a/res/drawable/lock_open_gray.png b/res/drawable/lock_open_gray.png
new file mode 100644
index 0000000..3c9cab4
--- /dev/null
+++ b/res/drawable/lock_open_gray.png
Binary files differ
diff --git a/res/drawable/lock_sky.png b/res/drawable/lock_sky.png
new file mode 100644
index 0000000..0b3efdb
--- /dev/null
+++ b/res/drawable/lock_sky.png
Binary files differ
diff --git a/res/drawable/mainlayer.xml b/res/drawable/mainlayer.xml
new file mode 100644
index 0000000..9ed210f
--- /dev/null
+++ b/res/drawable/mainlayer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image">
+      <bitmap android:src="@drawable/endo_medium_back_mask_top_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:bottom="5dp">
+      <bitmap android:src="@drawable/endo_medium_back_mask_middle_regular"
+       />
+    </item>
+</layer-list>
diff --git a/res/drawable/medium.png b/res/drawable/medium.png
new file mode 100644
index 0000000..3829e8c
--- /dev/null
+++ b/res/drawable/medium.png
Binary files differ
diff --git a/res/drawable/module_1x1_face_regular.png b/res/drawable/module_1x1_face_regular.png
new file mode 100644
index 0000000..64c6ea7
--- /dev/null
+++ b/res/drawable/module_1x1_face_regular.png
Binary files differ
diff --git a/res/drawable/module_1x1_layer.xml b/res/drawable/module_1x1_layer.xml
new file mode 100644
index 0000000..da0b4fb
--- /dev/null
+++ b/res/drawable/module_1x1_layer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image">
+      <bitmap android:src="@drawable/module_1x1_face_regular"
+        />
+    </item>
+    <item android:id="@+id/second_image" android:left="8dp">
+      <bitmap android:src="@drawable/module_1x1_side_regular"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/module_1x1_side_regular.png b/res/drawable/module_1x1_side_regular.png
new file mode 100644
index 0000000..4224047
--- /dev/null
+++ b/res/drawable/module_1x1_side_regular.png
Binary files differ
diff --git a/res/drawable/module_1x2_face_regular.png b/res/drawable/module_1x2_face_regular.png
new file mode 100644
index 0000000..cdf4d98
--- /dev/null
+++ b/res/drawable/module_1x2_face_regular.png
Binary files differ
diff --git a/res/drawable/module_1x2_layer.xml b/res/drawable/module_1x2_layer.xml
new file mode 100644
index 0000000..2da7120
--- /dev/null
+++ b/res/drawable/module_1x2_layer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image">
+      <bitmap android:src="@drawable/module_1x2_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:left="2dp">
+      <bitmap android:src="@drawable/module_1x2_side_regular"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/module_1x2_side_regular.png b/res/drawable/module_1x2_side_regular.png
new file mode 100644
index 0000000..f6dee41
--- /dev/null
+++ b/res/drawable/module_1x2_side_regular.png
Binary files differ
diff --git a/res/drawable/module_2x1_face_regular.png b/res/drawable/module_2x1_face_regular.png
new file mode 100644
index 0000000..b501a17
--- /dev/null
+++ b/res/drawable/module_2x1_face_regular.png
Binary files differ
diff --git a/res/drawable/module_2x1_layer.xml b/res/drawable/module_2x1_layer.xml
new file mode 100644
index 0000000..849caa2
--- /dev/null
+++ b/res/drawable/module_2x1_layer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image">
+      <bitmap android:src="@drawable/module_2x1_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:left="8dp">
+      <bitmap android:src="@drawable/module_2x1_side_regular"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/module_2x1_side_regular.png b/res/drawable/module_2x1_side_regular.png
new file mode 100644
index 0000000..6633a12
--- /dev/null
+++ b/res/drawable/module_2x1_side_regular.png
Binary files differ
diff --git a/res/drawable/module_2x2_face_regular.png b/res/drawable/module_2x2_face_regular.png
new file mode 100644
index 0000000..b843671
--- /dev/null
+++ b/res/drawable/module_2x2_face_regular.png
Binary files differ
diff --git a/res/drawable/module_2x2_layer.xml b/res/drawable/module_2x2_layer.xml
new file mode 100644
index 0000000..2e37871
--- /dev/null
+++ b/res/drawable/module_2x2_layer.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/first_image">
+      <bitmap android:src="@drawable/module_2x2_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:left="8dp">
+      <bitmap android:src="@drawable/module_2x2_side_regular"
+         />
+    </item>
+</layer-list>
diff --git a/res/drawable/module_2x2_side_regular.png b/res/drawable/module_2x2_side_regular.png
new file mode 100644
index 0000000..35dc461
--- /dev/null
+++ b/res/drawable/module_2x2_side_regular.png
Binary files differ
diff --git a/res/drawable/module_mediumscreen_back_face_regular.png b/res/drawable/module_mediumscreen_back_face_regular.png
new file mode 100644
index 0000000..7c5d6bf
--- /dev/null
+++ b/res/drawable/module_mediumscreen_back_face_regular.png
Binary files differ
diff --git a/res/drawable/module_mediumscreen_back_side_regular.png b/res/drawable/module_mediumscreen_back_side_regular.png
new file mode 100644
index 0000000..7f773ca
--- /dev/null
+++ b/res/drawable/module_mediumscreen_back_side_regular.png
Binary files differ
diff --git a/res/drawable/right_shadow.png b/res/drawable/right_shadow.png
new file mode 100644
index 0000000..2c4c272
--- /dev/null
+++ b/res/drawable/right_shadow.png
Binary files differ
diff --git a/res/drawable/right_shadow_close.png b/res/drawable/right_shadow_close.png
new file mode 100644
index 0000000..c5c21ad
--- /dev/null
+++ b/res/drawable/right_shadow_close.png
Binary files differ
diff --git a/res/drawable/right_shadow_one.png b/res/drawable/right_shadow_one.png
new file mode 100644
index 0000000..016b1fd
--- /dev/null
+++ b/res/drawable/right_shadow_one.png
Binary files differ
diff --git a/res/drawable/rightdrawer_layer.xml b/res/drawable/rightdrawer_layer.xml
new file mode 100644
index 0000000..a5db27d
--- /dev/null
+++ b/res/drawable/rightdrawer_layer.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+    >
+    <item android:id="@+id/first_image" android:right="5dp" android:bottom="1dp">
+      <bitmap android:src="@drawable/module_2x1_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:right="5dp" android:bottom="1dp">
+      <bitmap android:src="@drawable/module_2x1_side_regular"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/rightdrawer_layer_big.xml b/res/drawable/rightdrawer_layer_big.xml
new file mode 100644
index 0000000..46c4d62
--- /dev/null
+++ b/res/drawable/rightdrawer_layer_big.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+    >
+    <item android:id="@+id/first_image" android:right="5dp" android:bottom="1dp">
+      <bitmap android:src="@drawable/module_2x2_face_regular"
+       />
+    </item>
+    <item android:id="@+id/second_image"  android:right="5dp" android:bottom="1dp">
+      <bitmap android:src="@drawable/module_2x2_side_regular"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/rightdrawer_layer_close.xml b/res/drawable/rightdrawer_layer_close.xml
new file mode 100644
index 0000000..a956c54
--- /dev/null
+++ b/res/drawable/rightdrawer_layer_close.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+            >
+  <item android:id="@+id/first_image"  >
+    <bitmap android:src="@drawable/module_2x1_face_regular" />
+  </item>
+  <item android:id="@+id/second_image"   >
+    <bitmap android:src="@drawable/right_shadow_one" />
+  </item>
+</layer-list>
diff --git a/res/drawable/rightdrawer_layer_open.xml b/res/drawable/rightdrawer_layer_open.xml
new file mode 100644
index 0000000..8b46914
--- /dev/null
+++ b/res/drawable/rightdrawer_layer_open.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+    >
+    <item android:id="@+id/first_image"  >
+      <bitmap android:src="@drawable/module_2x1_face_regular"
+       />
+    </item>
+ <item android:id="@+id/second_image" >
+      <bitmap android:src="@drawable/right_shadow_close"
+        />
+    </item>
+</layer-list>
diff --git a/res/drawable/small.png b/res/drawable/small.png
new file mode 100644
index 0000000..5b736ab
--- /dev/null
+++ b/res/drawable/small.png
Binary files differ
diff --git a/res/drawable/unlock_black.png b/res/drawable/unlock_black.png
new file mode 100644
index 0000000..9d090d2
--- /dev/null
+++ b/res/drawable/unlock_black.png
Binary files differ
diff --git a/res/drawable/xlarge.png b/res/drawable/xlarge.png
new file mode 100644
index 0000000..59b93c0
--- /dev/null
+++ b/res/drawable/xlarge.png
Binary files differ
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index 6e87eb6..93c61e5 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -1,69 +1,348 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              xmlns:tools="http://schemas.android.com/tools"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:paddingBottom="@dimen/activity_vertical_margin"
-              android:paddingLeft="@dimen/activity_horizontal_margin"
-              android:paddingRight="@dimen/activity_horizontal_margin"
-              android:paddingTop="@dimen/activity_vertical_margin"
-              tools:context=".MainActivity" >
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent"
+                android:background="#FFFFFF" >
 
-  <LinearLayout
-      xmlns:android="http://schemas.android.com/apk/res/android"
-      xmlns:tools="http://schemas.android.com/tools"
-      android:orientation="horizontal"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      tools:context=".MainActivity">
-
-    <TextView
-        android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
-        android:layout_weight="1"
-        android:text="@string/port_input"/>
-
-    <EditText
-        android:id="@+id/portNumber"
-        android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
-        android:layout_weight="1"
-        android:inputType="number"
-        android:text="@string/port_number_initial"/>
-
-  </LinearLayout>
-
-  <LinearLayout
-      xmlns:android="http://schemas.android.com/apk/res/android"
-      xmlns:tools="http://schemas.android.com/tools"
-      android:orientation="horizontal"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      tools:context=".MainActivity">
-
-    <Button
-        android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
-        android:layout_weight="1"
-        android:text="@string/epm_attach"
-        android:id="@+id/attachButton"
-        android:onClick="attachEpm" />
-
-    <Button
-        android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
-        android:layout_weight="1"
-        android:id="@+id/detachButton"
-        android:text="@string/epm_detach"
-        android:onClick="detachEpm" />
-
-  </LinearLayout>
-
-  <TextView
-      android:id="@+id/statusText"
-      android:layout_height="wrap_content"
+  <View
+      android:id="@+id/linearroot"
       android:layout_width="fill_parent"
-      android:layout_weight="1"
-      android:text="@string/status_text_initial"/>
+      android:layout_height="fill_parent"
+      android:layout_centerInParent="true"
+      android:layout_marginBottom="50dp"
+      android:layout_marginLeft="70dp"
+      android:layout_marginRight="70dp"
+      android:layout_marginTop="50dp"
+      android:background="@drawable/endo_medium_back_full_regular_1" >
+  </View>
 
-</LinearLayout>
+  <LinearLayout
+      android:id="@+id/linearroot"
+      android:layout_width="fill_parent"
+      android:layout_height="fill_parent"
+      android:layout_centerInParent="true"
+      android:layout_marginBottom="50dp"
+      android:layout_marginLeft="50dp"
+      android:layout_marginRight="45dp"
+      android:layout_marginTop="50dp"
+      android:background="@android:color/transparent"
+      android:orientation="horizontal"
+      android:weightSum="3" >
+
+    <LinearLayout
+        android:id="@+id/linear"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="01.0"
+        android:orientation="vertical"
+        android:weightSum="3" >
+
+      <ImageView
+          android:id="@+id/linear_view1"
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07"
+          android:background="@android:color/transparent" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.87">
+
+        <ImageView
+            android:id="@+id/leftside_first_left_dwar_detach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="19dp"
+            android:src="@drawable/lock_sky" />
+
+        <ImageView
+            android:id="@+id/leftside_first_left_dwar_attach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="false"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"
+            android:src="@drawable/lock_open_gray"
+            android:visibility="gone"
+            />
+      </RelativeLayout>
+
+      <ImageView
+          android:id="@+id/linear_view2"
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07"
+          android:background="@android:color/transparent" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.91" >
+
+        <ImageView
+            android:id="@+id/leftside_2nd_left_dwar_detach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"
+            android:src="@drawable/lock_sky" />
+
+        <ImageView
+            android:id="@+id/leftside_2nd_left_dwar_attach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="false"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"
+            android:src="@drawable/lock_open_gray"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.42" >
+
+        <ImageView
+            android:id="@+id/leftside_3rd_left_dwar_detach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"/>
+
+        <ImageView
+            android:id="@+id/leftside_3rd_left_dwar_attach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="false"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.42" >
+
+        <ImageView
+            android:id="@+id/leftside_4th_left_dwar_detach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"/>
+
+        <ImageView
+            android:id="@+id/leftside_4th_left_dwar_attach"
+            android:layout_width="60dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="false"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/leftdrawer_layer1x2"
+            android:padding="18dp"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.06" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="fill_parent"
+        android:layout_weight="0.11"
+        android:orientation="vertical" >
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="2.01"
+        android:orientation="vertical"
+        android:weightSum="3" >
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.39"
+          android:paddingRight="5dp" >
+
+        <ImageView
+            android:id="@+id/rightside_1st_left_dwar_detach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer"
+            android:paddingBottom="18dp"
+            android:paddingTop="18dp"
+            android:src="@drawable/lock_sky" />
+
+        <ImageView
+            android:id="@+id/rightside_1st_left_dwar_attach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:layout_marginRight="7dp"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer"
+            android:paddingBottom="18dp"
+            android:paddingTop="18dp"
+            android:src="@drawable/lock_open_gray"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.9"
+          android:paddingRight="5dp" >
+
+        <ImageView
+            android:id="@+id/rightside_2nd_left_dwar_detach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer_big"
+            android:padding="45dp"
+            android:src="@drawable/lock_sky" />
+
+        <ImageView
+            android:id="@+id/rightside_2nd_left_dwar_attach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:layout_marginRight="7dp"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer_big"
+            android:padding="45dp"
+            android:src="@drawable/lock_open_gray"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.9"
+          android:paddingRight="5dp" >
+
+        <ImageView
+            android:id="@+id/rightside_3rd_left_dwar_detach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer_big"
+            android:padding="45dp"
+            android:src="@drawable/lock_sky" />
+
+        <ImageView
+            android:id="@+id/rightside_3rd_left_dwar_attach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:layout_marginRight="7dp"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer_big"
+            android:padding="45dp"
+            android:src="@drawable/lock_open_gray"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+
+      <RelativeLayout
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.42"
+          android:paddingRight="5dp" >
+
+        <ImageView
+            android:id="@+id/rightside_4th_left_dwar_detach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentLeft="true"
+            android:layout_gravity="center"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer"
+            android:padding="20dp"/>
+
+        <ImageView
+            android:id="@+id/rightside_4th_left_dwar_attach"
+            android:layout_width="120dp"
+            android:layout_height="fill_parent"
+            android:layout_alignParentRight="true"
+            android:layout_gravity="center"
+            android:layout_marginRight="7dp"
+            android:adjustViewBounds="true"
+            android:background="@drawable/rightdrawer_layer"
+            android:padding="20dp"
+            android:visibility="gone" />
+      </RelativeLayout>
+
+      <View
+          android:layout_width="fill_parent"
+          android:layout_height="0dp"
+          android:layout_weight="0.07" />
+    </LinearLayout>
+
+  </LinearLayout>
+
+</RelativeLayout>
diff --git a/src/com/projectara/araepm/MainActivity.java b/src/com/projectara/araepm/MainActivity.java
index 2981c9e..84076de 100644
--- a/src/com/projectara/araepm/MainActivity.java
+++ b/src/com/projectara/araepm/MainActivity.java
@@ -1,20 +1,44 @@
 package com.projectara.araepm;
 
-import android.os.Bundle;
 import android.app.Activity;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-import java.io.IOException;
-import android.os.Handler;
+import android.os.Bundle;
 import android.util.Log;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
+import android.view.animation.AnimationUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.Switch;
+import android.widget.Toast;
 
 public class MainActivity extends Activity
-    implements EpmController.EpmChangeCallback {
+    implements AnimationListener, EpmController.EpmChangeCallback {
 
-    private static final String TAG = "araepm";
+    private static final String TAG = "AraEPM";
+
+    //
+    // The following group of fields are locked by `this'.
+    //
+
+    // Index into {left,right}Side{Attach,Detach}, depending on
+    // current animation (which we obtain in onAnimationEnd).
+    //
+    // If no animation ongoing, this is -1.
+    private int ivIndex;
+    // If true, an EPM change is ongoing.
+    private boolean epmChangeOngoing;
+    // If false, button clicks will be ignored.
+    private boolean buttonPressesEnabled;
+
+    private ImageView leftSideAttach[];
+    private ImageView leftSideDetach[];
+    private ImageView rightSideAttach[];
+    private ImageView rightSideDetach[];
+
+    private Animation leftsideAnimAttach,leftsideAnimDetach;
+    private Animation rightsideAnimAttach, rightsideAnimDetach;
+
+    private EpmController epmController;
 
     private static String EPM_ATTACHED;
     private static String EPM_DETACHED;
@@ -26,19 +50,35 @@
     private static String EPM_STATUS_ERROR;
     private static String EPM_STATUS_TIMEOUT;
 
-    private TextView statusText;
-    private EditText portNumber;
-    private Handler handler;
-    private Button[] buttons;
-
-    private EpmController epmController;
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
-        portNumber = (EditText)findViewById(R.id.portNumber);
-        statusText = (TextView)findViewById(R.id.statusText);
+
+        initializeImageviewAnimation();
+    }
+
+    private void enableButtonPressesLocked() {
+        Log.d(TAG, "enabling button presses");
+        if (ivIndex != -1) {
+            Log.wtf(TAG, "ivIndex=" + ivIndex + ", expected -1");
+        }
+        if (epmChangeOngoing) {
+            Log.wtf(TAG, "epm change is still ongoing!");
+        }
+        buttonPressesEnabled = true;
+    }
+
+    private void disableButtonPressesLocked() {
+        Log.d(TAG, "disabling button presses");
+        buttonPressesEnabled = false;
+    }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        epmController = new EpmController(this, this);
+        epmController.start();
 
         EPM_ATTACHED = getString(R.string.epm_attached);
         EPM_DETACHED = getString(R.string.epm_detached);
@@ -49,129 +89,304 @@
         EPM_STATUS_OK = getString(R.string.epm_status_ok);
         EPM_STATUS_ERROR = getString(R.string.epm_status_error);
         EPM_STATUS_TIMEOUT = getString(R.string.epm_status_timeout);
-
-        buttons = new Button[2];
-        buttons[0] = (Button)findViewById(R.id.attachButton);
-        buttons[1] = (Button)findViewById(R.id.detachButton);
-
-        handler = new Handler();
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        // Inflate the menu; this adds items to the action bar if it is present.
-        getMenuInflater().inflate(R.menu.main, menu);
-        return true;
-    }
-
-    @Override
-    protected void onStart(){
-        Log.d(TAG, "onstart");
-        super.onStart();
-        epmController = new EpmController(this, this);
-        epmController.start();
     }
 
     @Override
     protected void onStop() {
-        Log.d(TAG, "onstop");
         super.onStop();
         epmController.stop();
         epmController = null;
     }
 
-    private void disableStateChanges() {
-        for (int i = 0; i < buttons.length; i++) {
-            buttons[i].setClickable(false);
-        }
-    }
-
-    private void enableStateChanges() {
-        for (int i = 0; i < buttons.length; i++) {
-            buttons[i].setClickable(true);
-        }
-    }
-
-    private int getPortNumber() {
-        String s = portNumber.getText().toString();
-        try {
-            return Integer.parseInt(s);
-        } catch (NumberFormatException nfe) {
-            // Can't happen; portNumber only allows numeric input
-            Log.wtf(TAG, "non-numeric text " + s + " in portNumber");
-            return -1;
-        }
-    }
-
-    private void doAttachDetach(boolean attach) {
-        int port = getPortNumber();
-        if (port < 0) {
-            return;
-        }
-        Log.d(TAG,
-              (attach ? "Attaching" : "Detaching") + " EPM on port " + port);
-        disableStateChanges();
-        if (attach) {
-            statusText.setText(String.format(EPM_ATTACHING, port));
-            epmController.attachEpm(port);
-        } else {
-            statusText.setText(String.format(EPM_DETACHING, port));
-            epmController.detachEpm(port);
-        }
-    }
-
-    public void attachEpm(View view) {
-        doAttachDetach(true);
-    }
-
-    public void detachEpm(View view) {
-        doAttachDetach(false);
+    @Override
+    public void onAnimationRepeat(Animation animation) {
+        // nop
     }
 
     @Override
-    public void onEpmChangeFinished(EpmController.EpmState attemptedState,
-                                    EpmController.EpmChangeStatus changeStatus,
-                                    int changedPort) {
-        final EpmController.EpmState attempted = attemptedState;
-        final EpmController.EpmChangeStatus status = changeStatus;
-        final int port = changedPort;
-        handler.post(new Runnable() {
-                @Override
-                public void run() {
-                    String newStatus;
-                    String s;
+    public void onAnimationStart(Animation animation) {
+        // nop
+    }
 
-                    enableStateChanges();
+    @Override
+    public void onAnimationEnd(Animation animation) {
+        Log.d(TAG, "onAnimationEnd");
 
-                    switch (attempted) {
-                    case EPM_ATTACH:
-                        s = EPM_ATTACHED;
-                        break;
-                    case EPM_DETACH:
-                        s = EPM_DETACHED;
-                        break;
-                    default:
-                        Log.wtf(TAG, "can't happen");
-                        return;
-                    }
+        if (animation == leftsideAnimAttach) {
+            leftSideDetach[ivIndex].setVisibility(View.GONE);
+            leftSideAttach[ivIndex].setVisibility(View.VISIBLE);
+        }
+        if (animation == leftsideAnimDetach) {
+            leftSideAttach[ivIndex].setVisibility(View.GONE);
+            leftSideDetach[ivIndex].setVisibility(View.VISIBLE);
+        }
+        if (animation == rightsideAnimAttach) {
+            rightSideDetach[ivIndex].setVisibility(View.GONE);
+            rightSideAttach[ivIndex].setVisibility(View.VISIBLE);
+        }
+        if (animation == rightsideAnimDetach) {
+            rightSideAttach[ivIndex].setVisibility(View.GONE);
+            rightSideDetach[ivIndex].setVisibility(View.VISIBLE);
+        }
 
-                    String statusFormat;
-                    switch (status) {
-                    case EPM_OK:
-                        statusFormat = EPM_STATUS_OK;
-                        break;
-                    case EPM_ERROR:
-                        statusFormat = EPM_STATUS_ERROR;
-                        break;
-                    case EPM_TIMEOUT:
-                        statusFormat = EPM_STATUS_TIMEOUT;
-                        break;
-                    default:
-                        Log.wtf(TAG, "can't happen");
-                        return;
-                    }
-                    statusText.setText(String.format(statusFormat, s, port));
+        synchronized (this) {
+            ivIndex = -1;
+            if (!epmChangeOngoing) {
+                enableButtonPressesLocked();
+            }
+        }
+    }
+
+    @Override
+    public void onEpmChangeFinished(EpmController.EpmState state,
+                                    EpmController.EpmChangeStatus status,
+                                    int port) {
+        Log.d(TAG, "onEpmChangeFinished: state=" + state + ", status=" + status +
+              ", port=" + port);
+
+        String s;
+        switch (state) {
+        case EPM_ATTACH:
+            s = EPM_ATTACHED;
+            break;
+        case EPM_DETACH:
+            s = EPM_DETACHED;
+            break;
+        default:
+            Log.wtf(TAG, "can't happen");
+            s = null;
+            return;
+        }
+
+        String statusFormat;
+        switch (status) {
+        case EPM_OK:
+            statusFormat = EPM_STATUS_OK;
+            break;
+        case EPM_ERROR:
+            statusFormat = EPM_STATUS_ERROR;
+            break;
+        case EPM_TIMEOUT:
+            statusFormat = EPM_STATUS_TIMEOUT;
+            break;
+        default:
+            Log.wtf(TAG, "can't happen");
+            statusFormat = null;
+            return;
+        }
+
+        if (s != null && statusFormat != null) {
+            int duration = Toast.LENGTH_SHORT;
+            String text = String.format(statusFormat, s, port);
+            Toast toast = Toast.makeText(getApplicationContext(), text,
+                                         duration);
+            toast.show();
+        }
+
+        synchronized (this) {
+            epmChangeOngoing = false;
+            if (ivIndex == -1) {
+                enableButtonPressesLocked();
+            }
+        }
+    }
+
+    public void initializeImageviewAnimation() {
+        leftSideAttach = new ImageView[] {
+            (ImageView) findViewById(R.id.leftside_first_left_dwar_attach),
+            (ImageView) findViewById(R.id.leftside_2nd_left_dwar_attach),
+            (ImageView) findViewById(R.id.leftside_3rd_left_dwar_attach),
+            (ImageView) findViewById(R.id.leftside_4th_left_dwar_attach)};
+
+        leftSideDetach = new ImageView[] {
+            (ImageView) findViewById(R.id.leftside_first_left_dwar_detach),
+            (ImageView) findViewById(R.id.leftside_2nd_left_dwar_detach),
+            (ImageView) findViewById(R.id.leftside_3rd_left_dwar_detach),
+            (ImageView) findViewById(R.id.leftside_4th_left_dwar_detach)};
+
+        rightSideAttach = new ImageView[] {
+            (ImageView) findViewById(R.id.rightside_1st_left_dwar_attach),
+            (ImageView) findViewById(R.id.rightside_2nd_left_dwar_attach),
+            (ImageView) findViewById(R.id.rightside_3rd_left_dwar_attach),
+            (ImageView) findViewById(R.id.rightside_4th_left_dwar_attach)};
+
+        rightSideDetach = new ImageView[] {
+            (ImageView) findViewById(R.id.rightside_1st_left_dwar_detach),
+            (ImageView) findViewById(R.id.rightside_2nd_left_dwar_detach),
+            (ImageView) findViewById(R.id.rightside_3rd_left_dwar_detach),
+            (ImageView) findViewById(R.id.rightside_4th_left_dwar_detach)};
+
+        // Load animations and set listener.
+        leftsideAnimAttach = AnimationUtils.loadAnimation(getApplicationContext(),
+                                                          R.anim.leftside_move_leftside);
+        leftsideAnimDetach = AnimationUtils.loadAnimation(getApplicationContext(),
+                                                          R.anim.leftside_move_rightside);
+        rightsideAnimAttach = AnimationUtils.loadAnimation(getApplicationContext(),
+                                                           R.anim.move_right_rightside);
+        rightsideAnimDetach = AnimationUtils.loadAnimation(getApplicationContext(),
+                                                           R.anim.move_right_leftside);
+        leftsideAnimAttach.setAnimationListener(this);
+        leftsideAnimDetach.setAnimationListener(this);
+        rightsideAnimAttach.setAnimationListener(this);
+        rightsideAnimDetach.setAnimationListener(this);
+
+        // All set; initialize EPM image views and event handling.
+        for (int i = 0; i < leftSideAttach.length; i++) {
+            ImageView iv = leftSideAttach[i];
+            iv.setVisibility(View.GONE);
+            iv.setOnClickListener(new EpmButtonClickListener(iv, true, i, true));
+        }
+        for (int i = 0; i < rightSideAttach.length; i++) {
+            ImageView iv = rightSideAttach[i];
+            iv.setVisibility(View.GONE);
+            iv.setOnClickListener(new EpmButtonClickListener(iv, false, i, true));
+        }
+        for (int i = 0; i < leftSideDetach.length; i++) {
+            ImageView iv = leftSideDetach[i];
+            iv.setOnClickListener(new EpmButtonClickListener(iv, true, i, false));
+        }
+        for (int i = 0; i < rightSideDetach.length; i++) {
+            ImageView iv = rightSideDetach[i];
+            iv.setOnClickListener(new EpmButtonClickListener(iv, false, i, false));
+        }
+
+        synchronized (this) {
+            ivIndex = -1;
+            epmChangeOngoing = false;
+            enableButtonPressesLocked();
+        }
+    }
+
+    class EpmButtonClickListener implements View.OnClickListener {
+        private ImageView iv;
+        private boolean isLeft;
+        private int index;
+        private boolean isAttach;
+
+        /**
+         * Handles EPM changes and mutual exclusion between buttons.
+         *
+         * Example arguments for a button listener to attach the top
+         * left EPM, when endo is viewed from rear:
+         *
+         * - iv=(the button)
+         * - isLeft=true
+         * - index=0
+         * - isAttach=true
+         *
+         * @param iv     The ImageView clicked.
+         * @param isLeft Is the button on the left side of the endo,
+         *               when viewed from the rear?
+         * @param index  Zero-indexed button number, from endo top
+         * @param attach Should the button, when clicked, attach the EPM?
+         */
+        public EpmButtonClickListener(ImageView iv, boolean isLeft,
+                                      int index, boolean isAttach) {
+            this.iv = iv;
+            this.isLeft = isLeft;
+            this.index = index;
+            this.isAttach = isAttach;
+        }
+
+        @Override
+        public String toString() {
+            return "EpmButtonClickListener(iv=" + iv + ", isLeft=" + isLeft +
+                ", index=" + index + ",isAttach=" + isAttach + ")";
+        }
+
+        @Override
+        public void onClick(View v) {
+            Log.d(TAG, "onClick() handler called on: " +
+                  EpmButtonClickListener.this.toString());
+            int port = getPort();
+            if (port == -1) {
+                Log.e(TAG, "onClick: invalid state");
+                return;
+            }
+
+            // Enforce a single animation per EPM change.
+            synchronized (MainActivity.this) {
+                if (!buttonPressesEnabled) {
+                    Log.d(TAG, "Ignoring click while EPM change is ongoing");
+                    return;
+                } else {
+                    ivIndex = index;
+                    epmChangeOngoing = true;
+                    disableButtonPressesLocked();
                 }
-            });
+            }
+
+            iv.clearAnimation();
+            Log.i(TAG,
+                  (isAttach ? "Attaching " : "Detaching ") +
+                  " EPM on port " + port);
+            if (isAttach) {
+                epmController.attachEpm(port);
+            } else {
+                epmController.detachEpm(port);
+            }
+            // (The animations have confusing names.)
+            if (isLeft) {
+                if (isAttach) {
+                    v.startAnimation(leftsideAnimDetach);
+                } else {
+                    v.startAnimation(leftsideAnimAttach);
+                }
+            } else {
+                if (isAttach) {
+                    v.startAnimation(rightsideAnimDetach);
+                } else {
+                    v.startAnimation(rightsideAnimAttach);
+                }
+            }
+            Log.d(TAG, "onClick() handler finished");
+        }
+
+        // The layout, ignoring the buttons that are occupied by the
+        // switch (marked XX), looks like this, with port numbers
+        // underneath:
+        //
+        // +-----------------------+
+        // |       |     R1        |
+        // |  L1   |     4         |
+        // |  3    +---------------+
+        // |       |               |
+        // |       |               |
+        // +-------+     R2        +
+        // |       |     2         |
+        // |  L2   |               |
+        // |  1    +---------------+
+        // |       |               |
+        // |       |               |
+        // +-------+     R3        +
+        // |       |     0         |
+        // |  XX   |               |
+        // |       +---------------+
+        // |       |     XX        |
+        // |       |               |
+        // +-----------------------+
+        private int getPort() {
+            if (isLeft) {
+                switch (index) {
+                case 0:
+                    return 3;
+                case 1:
+                    return 1;
+                default:
+                    return -1;
+                }
+            } else {
+                switch (index) {
+                case 0:
+                    return 4;
+                case 1:
+                    return 2;
+                case 2:
+                    return 0;
+                default:
+                    return -1;
+                }
+            }
+        }
     }
 }