diff --git a/cps/db.py b/cps/db.py
index 2e428f72..f30fb609 100644
--- a/cps/db.py
+++ b/cps/db.py
@@ -445,6 +445,8 @@ class CalibreDB():
         cls.config = config
         cls.dispose()
 
+        # toDo: if db changed -> delete shelfs, delete download books, delete read boks, kobo sync??
+
         if not config.config_calibre_dir:
             config.invalidate()
             return False
diff --git a/cps/shelf.py b/cps/shelf.py
index be102ea9..6dae333c 100644
--- a/cps/shelf.py
+++ b/cps/shelf.py
@@ -381,27 +381,53 @@ def order_shelf(shelf_id):
                                  title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name),
                                  shelf=shelf, page="shelforder")
 
+def change_shelf_order(shelf_id, order):
+    result = calibre_db.session.query(db.Books).join(ub.BookShelf,ub.BookShelf.book_id == db.Books.id)\
+        .filter(ub.BookShelf.shelf == shelf_id).order_by(*order).all()
+    for index, entry in enumerate(result):
+        book = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id) \
+            .filter(ub.BookShelf.book_id == entry.id).first()
+        book.order = index
+    try:
+        ub.session.commit()
+    except OperationalError:
+        ub.session.rollback()
 
 def render_show_shelf(shelf_type, shelf_id, page_no, sort_param):
     shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()
 
     # check user is allowed to access shelf
     if shelf and check_shelf_view_permissions(shelf):
+
         if shelf_type == 1:
+            # order = [ub.BookShelf.order.asc()]
+            if sort_param == 'pubnew':
+                change_shelf_order(shelf_id, [db.Books.pubdate.desc()])
+            if sort_param == 'pubold':
+                change_shelf_order(shelf_id, [db.Books.pubdate])
+            if sort_param == 'abc':
+                change_shelf_order(shelf_id, [db.Books.sort])
+            if sort_param == 'zyx':
+                change_shelf_order(shelf_id, [db.Books.sort.desc()])
+            if sort_param == 'new':
+                change_shelf_order(shelf_id, [db.Books.timestamp.desc()])
+            if sort_param == 'old':
+                change_shelf_order(shelf_id, [db.Books.timestamp])
+            if sort_param == 'authaz':
+                change_shelf_order(shelf_id, [db.Books.author_sort.asc()])
+            if sort_param == 'authza':
+                change_shelf_order(shelf_id, [db.Books.author_sort.desc()])
             page = "shelf.html"
             pagesize = 0
-            order = [ub.BookShelf.order.asc()]
         else:
             pagesize = sys.maxsize
             page = 'shelfdown.html'
-            order = [ub.BookShelf.order.asc()]
 
         result, __, pagination = calibre_db.fill_indexpage(page_no, pagesize,
                                                             db.Books,
                                                             ub.BookShelf.shelf == shelf_id,
-                                                            order,
+                                                            [ub.BookShelf.order.asc()],
                                                             ub.BookShelf,ub.BookShelf.book_id == db.Books.id)
-
         # delete chelf entries where book is not existent anymore, can happen if book is deleted outside calibre-web
         wrong_entries = calibre_db.session.query(ub.BookShelf)\
             .join(db.Books, ub.BookShelf.book_id == db.Books.id, isouter=True)\
diff --git a/cps/static/js/main.js b/cps/static/js/main.js
index d02d3b58..d891d30e 100644
--- a/cps/static/js/main.js
+++ b/cps/static/js/main.js
@@ -497,6 +497,19 @@ $(function() {
         );
     });
 
+    $("#toggle_order_shelf").click(function() {
+        $("#new").toggleClass("disabled");
+        $("#old").toggleClass("disabled");
+        $("#asc").toggleClass("disabled");
+        $("#desc").toggleClass("disabled");
+        $("#auth_az").toggleClass("disabled");
+        $("#auth_za").toggleClass("disabled");
+        $("#pub_new").toggleClass("disabled");
+        $("#pub_old").toggleClass("disabled");
+        var alternative_text = $("#toggle_order_shelf").data('alt-text');
+        $("#toggle_order_shelf")[0].attributes['data-alt-text'].value = $("#toggle_order_shelf").html();
+        $("#toggle_order_shelf").html(alternative_text);
+    });
 
     $("#btndeluser").click(function() {
         ConfirmDialog(
diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html
index 32e3da4f..2110d905 100644
--- a/cps/templates/shelf.html
+++ b/cps/templates/shelf.html
@@ -8,8 +8,10 @@
   {% if g.user.is_authenticated %}
     {% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public  %}
       <div class="btn btn-danger" id="delete_shelf" data-value="{{ shelf.id }}">{{ _('Delete this Shelf') }}</div>
-      <a id="edit_shelf" href="{{ url_for('shelf.edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
+      <a id="edit_shelf" href="{{ url_for('shelf.edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf Properties') }} </a>
       {% if entries.__len__() %}
+      <a id="order_shelf" href="{{ url_for('shelf.order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Arrange books manually') }} </a>
+      <button id="toggle_order_shelf" type="button" data-alt-text="{{ _('Disable Change order') }}" class="btn btn-primary">{{ _('Enable Change order') }}</button>
         <div class="filterheader hidden-xs hidden-sm">
           <a data-toggle="tooltip" title="{{_('Sort according to book date, newest first')}}" id="new" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='new')}}"><span class="glyphicon glyphicon-book"></span> <span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order"></span></a>
           <a data-toggle="tooltip" title="{{_('Sort according to book date, oldest first')}}" id="old" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='old')}}"><span class="glyphicon glyphicon-book"></span> <span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order-alt"></span></a>
@@ -19,8 +21,6 @@
           <a data-toggle="tooltip" title="{{_('Sort authors in reverse alphabetical order')}}" id="auth_za" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='authza')}}"><span class="glyphicon glyphicon-user"></span><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></a>
           <a data-toggle="tooltip" title="{{_('Sort according to publishing date, newest first')}}" id="pub_new" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubnew')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order"></span></a>
           <a data-toggle="tooltip" title="{{_('Sort according to publishing date, oldest first')}}" id="pub_old" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubold')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order-alt"></span></a>
-          <a id="order_shelf" href="{{ url_for('shelf.order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary disabled">{{ _('Arrange books') }} </a>
-          <button id="enable_order_shelf" type="button" class="btn btn-primary">{{ _('Change order') }}</button>
         </div>
       {% endif %}
     {% endif %}
diff --git a/cps/templates/shelf_order.html b/cps/templates/shelf_order.html
index c5a698d2..1e49f29a 100644
--- a/cps/templates/shelf_order.html
+++ b/cps/templates/shelf_order.html
@@ -37,7 +37,7 @@
           </div>
         {% endfor %}
       </div>
-        <button onclick="sendData('{{ url_for('shelf.order_shelf', shelf_id=shelf.id) }}')" class="btn btn-default" id="ChangeOrder">{{_('Change order')}}</button>
+        <button onclick="sendData('{{ url_for('shelf.order_shelf', shelf_id=shelf.id) }}')" class="btn btn-default" id="ChangeOrder">{{_('Save')}}</button>
         <a href="{{ url_for('shelf.show_shelf', shelf_id=shelf.id) }}" id="shelf_back" class="btn btn-default">{{_('Back')}}</a>
   </div>
 {% endblock %}
diff --git a/cps/templates/shelfdown.html b/cps/templates/shelfdown.html
index 9ec154be..77251e02 100644
--- a/cps/templates/shelfdown.html
+++ b/cps/templates/shelfdown.html
@@ -55,27 +55,14 @@
       </div>
 
 	  <div class="btn-group" role="group" aria-label="Download, send to Kindle, reading">
-          {% if g.user.role_download() %}
+          {% if g.user.role_download() %}
             {% if entry.data|length %}
             <div class="btn-group" role="group">
-                {% if entry.data|length < 2 %}
-
-                  {% for format in entry.data %}
-                  <a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}" id="btnGroupDrop1{{format.format|lower}}" class="btn btn-primary" role="button">
-                    <span class="glyphicon glyphicon-download"></span>{{format.format}} ({{ format.uncompressed_size|filesizeformat }})
-                  </a>
-                  {% endfor %}
-                {% else %}
-                  <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                    <span class="glyphicon glyphicon-download"></span> {{_('Download')}}
-                    <span class="caret"></span>
-                  </button>
-                  <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
-                  {% for format in entry.data %}
-                    <li><a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}">{{format.format}} ({{ format.uncompressed_size|filesizeformat }})</a></li>
-                  {% endfor %}
-                  </ul>
-                {% endif %}
+                {% for format in entry.data %}
+                <a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}" id="btnGroupDrop{{entry.id}}{{format.format|lower}}" class="btn btn-primary" role="button">
+                  <span class="glyphicon glyphicon-download"></span>{{format.format}} ({{ format.uncompressed_size|filesizeformat }})
+                </a>
+                {% endfor %}
             </div>
             {% endif %}
           {% endif %}
diff --git a/cps/ub.py b/cps/ub.py
index dbc3b419..f11b77b9 100644
--- a/cps/ub.py
+++ b/cps/ub.py
@@ -452,7 +452,7 @@ def migrate_Database(session):
     if not engine.dialect.has_table(engine.connect(), "archived_book"):
         ArchivedBook.__table__.create(bind=engine)
     if not engine.dialect.has_table(engine.connect(), "registration"):
-        ReadBook.__table__.create(bind=engine)
+        Registration.__table__.create(bind=engine)
         with engine.connect() as conn:
             conn.execute("insert into registration (domain, allow) values('%.%',1)")
         session.commit()
@@ -501,12 +501,16 @@ def migrate_Database(session):
         for book_shelf in session.query(BookShelf).all():
             book_shelf.date_added = datetime.datetime.now()
         session.commit()
-    # Handle table exists, but no content
-    cnt = session.query(Registration).count()
-    if not cnt:
-        with engine.connect() as conn:
-            conn.execute("insert into registration (domain, allow) values('%.%',1)")
-        session.commit()
+    try:
+        # Handle table exists, but no content
+        cnt = session.query(Registration).count()
+        if not cnt:
+            with engine.connect() as conn:
+                conn.execute("insert into registration (domain, allow) values('%.%',1)")
+            session.commit()
+    except exc.OperationalError:  # Database is not writeable
+        print('Settings database is not writeable. Exiting...')
+        sys.exit(2)
     try:
         session.query(exists().where(BookShelf.order)).scalar()
     except exc.OperationalError:  # Database is not compatible, some columns are missing
@@ -591,7 +595,7 @@ def migrate_Database(session):
         session.commit()
     except exc.OperationalError:
         print('Settings database is not writeable. Exiting...')
-        sys.exit(1)
+        sys.exit(2)
 
 
 def clean_database(session):