diff --git a/AKPlan/templates/AKPlan/encode_events.html b/AKPlan/templates/AKPlan/encode_events.html
new file mode 100644
index 0000000000000000000000000000000000000000..2cb97b193e59fa910a0f4e9ea187079fcf8a0d51
--- /dev/null
+++ b/AKPlan/templates/AKPlan/encode_events.html
@@ -0,0 +1,17 @@
+{% load tz %}
+
+[
+    {% for slot in slots %}
+        {% if slot.start %}
+            {
+                'title': '{{ slot.ak.name }}',
+                'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
+                'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
+                'resourceId': '{{ slot.room.title }}',
+                'backgroundColor': '{{ slot.ak.category.color }}',
+                'borderColor': '{{ slot.ak.track.color }}',
+                'url': '{% url 'submit:ak_detail' event_slug=event.slug pk=slot.ak.pk %}'
+            },
+        {% endif %}
+    {% endfor %}
+]
diff --git a/AKPlan/templates/AKPlan/encode_rooms.html b/AKPlan/templates/AKPlan/encode_rooms.html
new file mode 100644
index 0000000000000000000000000000000000000000..55138df0ead3d3db7b6959fe7be72684147baf74
--- /dev/null
+++ b/AKPlan/templates/AKPlan/encode_rooms.html
@@ -0,0 +1,15 @@
+[
+    {% for room in rooms %}
+        {
+            'id': '{{ room.title }}',
+            'title': '{{ room.title }}',
+            'parentId': '{{ room.building }}',
+        },
+    {% endfor %}
+    {% for building in buildings %}
+        {
+            'id': '{{ building }}',
+            'title': '{{ building }}',
+        },
+    {% endfor %}
+]
diff --git a/AKPlan/templates/AKPlan/plan_index.html b/AKPlan/templates/AKPlan/plan_index.html
index 520c678ea094546c975909d115db338ac73eb3f1..032d8eda439a774b7882335c7e5a4424b6b7b106 100644
--- a/AKPlan/templates/AKPlan/plan_index.html
+++ b/AKPlan/templates/AKPlan/plan_index.html
@@ -57,26 +57,8 @@
                 eventColor: '#127ba3',
                 resourceAreaWidth: '15%',
                 resourceLabelText: '{% trans "Room" %}',
-                resources: [
-                    {% for room in rooms %}
-                        {
-                            'id': '{{ room.title }}',
-                            'title': '{{ room.title }}'
-                        },
-                    {% endfor %}
-                ],
-                events: [
-                    {% for slot in akslots %}
-                        {% if slot.room and slot.start %}
-                            {
-                                'title': '{{ slot.ak.name }}',
-                                'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
-                                'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
-                                'resourceId': '{{ slot.room.title }}',
-                            },
-                        {% endif %}
-                    {% endfor %}
-                ],
+                resources: {% include "AKPlan/encode_rooms.html" %},
+                events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
                 schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
             });
 
diff --git a/AKPlan/templates/AKPlan/plan_wall.html b/AKPlan/templates/AKPlan/plan_wall.html
index ca0896052cd36fa6aec8f888a11af9d8a7ecbccf..7507e88f491d6227ad847d0a6c2f81a03be30d82 100644
--- a/AKPlan/templates/AKPlan/plan_wall.html
+++ b/AKPlan/templates/AKPlan/plan_wall.html
@@ -70,18 +70,7 @@
                         },
                     {% endfor %}
                 ],
-                events: [
-                    {% for slot in akslots %}
-                        {% if slot.room and slot.start %}
-                            {
-                                'title': '{{ slot.ak.name }}',
-                                'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
-                                'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
-                                'resourceId': '{{ slot.room.title }}',
-                            },
-                        {% endif %}
-                    {% endfor %}
-                ],
+                events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
                 schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
             });
 
diff --git a/AKPlan/views.py b/AKPlan/views.py
index b1b598cc112ab1df3a615dd5831b2c8b5742df6b..e1b6191588b95df733fc3c85792d872e133fda85 100644
--- a/AKPlan/views.py
+++ b/AKPlan/views.py
@@ -28,12 +28,16 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
         context["akslots_now"] = []
         context["akslots_next"] = []
         rooms = set()
+        buildings = set()
 
         # Get list of current and next slots
         for akslot in context["akslots"]:
             # Construct a list of all rooms used by these slots on the fly
             if akslot.room is not None:
                 rooms.add(akslot.room)
+                # Store buildings for hierarchical view
+                if akslot.room.building != '':
+                    buildings.add(akslot.room.building)
 
             # Recent AKs: Started but not ended yet
             if akslot.start <= current_timestamp <= akslot.end:
@@ -45,6 +49,8 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
 
         # Sort list of rooms by title
         context["rooms"] = sorted(rooms, key=lambda x: x.title)
+        if settings.PLAN_SHOW_HIERARCHY:
+            context["buildings"] = sorted(buildings)
 
         return context
 
diff --git a/AKPlanning/settings.py b/AKPlanning/settings.py
index 57cb81e50c9b65f46cfc77a6c571fb6fb4067938..fc67a5424a76e10519fbbe1a77bb1dfdd4c0027c 100644
--- a/AKPlanning/settings.py
+++ b/AKPlanning/settings.py
@@ -162,5 +162,7 @@ PLAN_MAX_NEXT_AKS = 10
 # Specify range of plan for screen/projector view
 PLAN_WALL_HOURS_RETROSPECT = 3
 PLAN_WALL_HOURS_FUTURE = 18
+# Should the plan use a hierarchy of buildings and rooms?
+PLAN_SHOW_HIERARCHY = True
 
 include(optional("settings/*.py"))