diff --git a/README.md b/README.md
index 26b8f84d7891c56b93350f368b2897131e92e551..936da2832a7b53c63f9f2301ecbd0db9ccb69992 100644
--- a/README.md
+++ b/README.md
@@ -1,151 +1,124 @@
-# Tugas 1 IF3110 Pengembangan Aplikasi Berbasis Web
-
-Membuat sebuah Website Toko Buku
-## Deskripsi Singkat
-
-Pada tugas besar ini, Anda diminta untuk membuat aplikasi *toko buku online* **berbasis web** yang memungkinkan seorang pengguna untuk membeli dan memberi komentar pada buku. Untuk menggunakan aplikasi ini, seorang pengguna harus melakukan *login*. 
-
-Anda diminta untuk membuat tampilan sedemikian hingga mirip dengan tampilan pada contoh. Website yang diminta tidak responsive. Desain tampilan tidak perlu dibuat indah. Icon dan jenis font tidak harus sama dengan contoh. Warna font, garis pemisah, dan perbedaan ukuran font harus terlihat sesuai contoh. Format rating dan waktu harus terlihat sesuai contoh. Perhatikan juga **tata letak** elemen-elemen.
+# Laporan Tugas  Besar 1 IF3110 Pengembangan Aplikasi Berbasis Web
 
 ## Anggota Tim
 
-Setiap kelompok beranggotakan **3 orang dari kelas yang sama**. Jika jumlah mahasiswa dalam satu kelas modulo 3 menghasilkan 1, maka hanya 1 kelompok terdiri dari 4 mahasiswa. Jika jumlah mahasiswa modulo 3 menghasilkan 2, maka ada dua kelompok yang beranggotakan 4 orang.
+**Kelompok JLAS**
 
-## Petunjuk Pengerjaan
+<span style="font-family: Cursive">
+Alvin Limassa   13516039 <br />
+Suhendi         13516048 <br />
+Louis Leslie    13516087 <br />
+Jeffry          13516156 <br />
+</span>
 
-1. Buatlah organisasi pada gitlab dengan format "IF3110-2018-KXX-nama_kelompok", dengan XX adalah nomor kelas.
-2. Tambahkan anggota tim pada organisasi anda.
-3. Fork pada repository ini dengan organisasi yang telah dibuat.
-4. Ubah hak akses repository hasil Fork anda menjadi **private**.
-5. Silakan commit pada repository anda (hasil fork). Lakukan berberapa commit dengan pesan yang bermakna, contoh: `add register form`, `fix logout bug`, jangan seperti `final`, `benerin dikit`. Disarankan untuk tidak melakukan commit dengan perubahan yang besar karena akan mempengaruhi penilaian (contoh: hanya melakukan satu commit kemudian dikumpulkan). Sebaiknya commit dilakukan setiap ada penambahan fitur. **Commit dari setiap anggota tim akan mempengaruhi penilaian.** Jadi, setiap anggota tim harus melakukan commit yang berpengaruh terhadap proses pembuatan aplikasi.
-6. Edit file readme ini semenarik mungkin (gunakan panduan Markdown language), diperbolehkan untuk merubah struktur dari readme ini. (Soal tidak perlu dipertahankan).
-7. Pada Readme terdapat tampilan aplikasi, dokumentasi yang menjelaskan website yang Anda buat, dan penjelasan mengenai pembagian tugas masing-masing anggota (lihat formatnya pada bagian **pembagian tugas**).
-8. Merge request dari repository anda ke repository ini dengan format **Nama kelompok** - **NIM terkecil** - **Nama Lengkap dengan NIM terkecil** sebelum **26 Oktober 2018 23.59**.
+## Preview
 
-## Tools
+### **Login**
 
-1. Untuk backend, wajib menggunakan **PHP** tanpa framework apapun. Harap diperhatikan, Anda harus mengimplementasikan fitur menggunakan HTTP method yang tepat.
-2. Gunakan **MySQL** untuk menyimpan data.
-3. Untuk frontend, gunakan Javascript, HTML dan CSS. **Tidak boleh** menggunakan library atau framework CSS atau JS seperti JQuery atau Bootstrap. CSS sebisa mungkin ada di file yang berbeda dengan HTML (tidak inline styling).
+![](assets/preview/login.jpg)
 
-## Spesifikasi
+Pada halaman ini, pengguna dapat melakukan login dengan username yang telah didaftarkan. Bila username yang diinput belum terdapat di database, atau password yang diinput tidak sesuai dengan username yang diinput, aplikasi akan menampilkan peringatan kepada user bahwa username/password yang diinput tidak sah. 
 
-### Login
+#### *pesan error*
+![](assets/preview/error_login.jpg)
 
-![](mocks/login.png)
+Bila username dan password yang diinput terdapat di basis data dan cocok, pengguna akan di-*redirect* ke halaman Search Book.
 
-Pengguna dapat melakukan login sebagai user. Login hanya membandingkan username dan password saja, dan tidak perlu proteksi apapun. Identitas pengguna yang sudah login akan disimpan sebagai cookie dalam browser (misal cookie menyimpan id=2 menandakan bahwa pengguna dengan id 2 sudah login). Identitas tersebut tidak boleh disimpan sebagai parameter HTTP GET. Jika cookie ini tidak ada, maka pengguna dianggap belum login dan aplikasi akan selalu mengarahkan (*redirect*) pengguna ke halaman ini, meskipun pengguna membuka halaman yang lain. Masa berlaku cookie ditentukan sendiri oleh peserta.
+### **Register**
 
-**--Bonus--** 
-Data yang disimpan pada cookie berupa `access token` yang dibangkitkan secara random dan memiliki `expiry time`. Jika `access token` ini tidak ada atau tidak valid, maka pengguna dianggap belum login. `Expiry time` sebuah `access token` berbeda dengan waktu berlaku cookie.
+![](assets/preview/register.jpg)
 
-### Register
+Pada halaman ini, pengguna dapat mendaftarkan diri agar dapat menggunakan aplikasi ini. Pengguna harus mengisi semua biodata yang diminta. Terdapat beberapa ketentuan dalam mengisi biodata, antara lain username harus berjumlah 5-20 karakter alfanumerik, email harus sesuai dengan format email, password minimal 6 karakter, dan nomor telepon memiliki 9-12 angka. 
 
-![](mocks/register.png)
+Bila biodata yang diisi sudah lengkap dan sesuai ketentuan, pengguna akan otomatis melakukan login, dan di-*redirect* ke halaman Search Book.
 
-Pengguna dapat mendaftarkan diri sebagai user agar dapat menggunakan aplikasi ini. Pengguna tidak dapat mendaftarkan diri menggunakan email dan/atau username yang sudah pernah digunakan sebelumnya. **Validasi email dan username dilakukan menggunakan AJAX**. Jika email dan username valid akan ditandai dengan lambang centang seperti pada gambar. Setelah mendaftarkan diri, pengguna akan secara otomatis login dengan user yang baru didaftarkannya.
+### **Search Book**
 
-### Search-Books
+![](assets/preview/search.jpg)
 
-![](mocks/search.png)
+Search Books merupakan halaman utama yang ditampilkan ketika user telah login. Pada halaman Search Books, terdapat sebuah input field yang dapat diisi pengguna untuk melakukan pencarian buku berdasarkan judul.
 
-Search-Books merupakan halaman utama yang ditampilkan ketika user telah login. Pada halaman Search-Books, terdapat sebuah input field dapat diisi pengguna untuk melakukan pencarian buku berdasarkan judul.
+Setelah pengguna menekan tombol search, pengguna akan dibawa ke halaman Hasil Search.
 
-Setelah pengguna menekan tombol search, pengguna akan dibawa ke halaman Search-Result.
+Pada bagian atas terdapat Navigation Bar, yang terdiri dari logo, tombol logout, dan tulisan dengan format "Hi, \<username\>". Selanjutnya, terdapat menu bar yang menampilkan 3 menu utama seperti pada gambar. Menu yang sedang dibuka diberikan warna background yang berbeda sebagai penanda halaman apa yang sedang dibuka pengguna.
 
-Perlu diperhatikan, pada bagian atas terdapat logo, tombol logout, dan tulisan dengan format "Hi, username". Selanjutnya, terdapat menu bar yang menampilkan 3 menu utama seperti pada gambar. Menu yang sedang dibuka diberikan warna background yang berbeda sebagai penanda halaman apa yang sedang dibuka pengguna.
+### **Hasil Search**
 
-### Search-Result
+![](assets/preview/search_result.jpg)
 
-![](mocks/search_result.png)
+Pada Hasil Search, ditampilkan daftar buku dan jumlah hasil pencarian. Pada tiap entri buku ditampilkan judul, penulis, gambar, potongan sinopsis, serta rating dari buku tersebut. Jika tombol detail ditekan, pengguna akan dibawa ke halaman Detail Buku dari buku yang bersangkutan.
 
-Pada Search-Result, ditampilkan daftar buku dan jumlah hasil pencarian. Pada tiap entri buku ditampilkan judul, penulis, gambar, potongan sinopsis, serta rating dari buku tersebut. Jika tombol detail ditekan, pengguna akan dibawa ke halaman Book-Detail dari buku yang bersangkutan.
+### **Detail Buku**
 
-### Book-Detail
-
-![](mocks/detail.png)
+![](assets/preview/detail.jpg)
 
 Pada halaman ini, ditampilkan detail buku yang terdiri dari judul, penulis, gambar, rating, serta komentar dan rating dari user lain.
 
-Pada halaman ini juga disediakan dropdown untuk memasukkan jumlah buku yang ingin dipesan dan tombol order. Jika tombol order ditekan, proses pemesanan akan dilakukan **menggunakan AJAX**, yang berarti halaman tidak akan di-*refresh* setelah tombol order ditekan. Tidak ada proses pembayaran yang ditangani oleh sistem.
-
-![](mocks/notification.png)
-
-Setelah proses pemesanan selesai dilakukan, akan muncul notifikasi pada browser pengguna. **Jangan menampilkan notifikasi setelah tombol order ditekan, tetapi setelah mendapat response dari AJAX**. Informasi yang diberikan oleh notifikasi mengikuti contoh.
+Pada halaman ini juga disediakan dropdown untuk memasukkan jumlah buku yang ingin dipesan dan tombol order. Jika tombol order ditekan, proses pemesanan akan dilakukan dan akan muncul notifikasi seperti gambar di bawah.
 
-**--Bonus--**
-Tampilan notifikasi dibuat semirip mungkin dengan contoh.
+![](assets/preview/notification.jpg)
 
-### Profile
+### **Profile**
 
-![](mocks/profile.png)
+![](assets/preview/profile.jpg)
 
-Pada halaman ini, ditampilkan nama lengkap, username, email, alamat, nomor telepon, dan foto profil. Pada bagian kanan atas terdapat tombol edit, jika pengguna menekan tombol tersebut, pengguna dibawa ke halaman Edit-Profile.
+Pada halaman ini, ditampilkan nama lengkap, email, alamat, nomor telepon, dan foto profil. Pada bagian kanan atas terdapat tombol edit, yang bila pengguna menekan tombol tersebut, pengguna dibawa ke halaman Edit Profile.
 
-### Edit-Profile
+### **Edit Profile**
 
-![](mocks/edit_profile.png)
+![](assets/preview/edit_profile.jpg)
 
 Pada halaman ini, pengguna dapat mengubah nama yang ditampilkan, alamat, nomor telepon, dan foto profil.
 
-Pada bagian bawah halaman, terdapat tombol Back dan Save. Jika tombol Back ditekan, pengguna kembali ke halaman Profile tanpa mengubah informasi profilnya. Jika tombol save ditekan, nama dan alamat pengguna akan diganti sesuai input field, dan pengguna dibawa ke halaman Profile.
+Pada bagian bawah halaman, terdapat tombol Back dan Save. Jika tombol Back ditekan, pengguna kembali ke halaman Profile tanpa mengubah informasi profilnya. Jika tombol Save ditekan, nama, alamat dan nomor telepon pengguna akan diganti dengan data yang diisi pada *input field*, dan pengguna akan dibawa balik ke halaman Profile.
 
-### History
+### **History**
 
-![](mocks/history.png)
+![](assets/preview/history.jpg)
 
 Pada halaman ini, ditampilkan daftar buku yang sudah pernah dipesan oleh pengguna, diurutkan berdasarkan waktu pemesanan dengan pesanan paling baru merupakan entri paling atas.
 
-Pada tiap entri pada history, terdapat tombol review. Jika tombol review ditekan, pengguna akan dibawa ke halaman Review. Jika pengguna sudah memberikan review untuk order tersebut, tombol review akan hilang dari entri yang bersangkutan.
+Pada tiap entri pada History, terdapat tombol Review. Jika tombol Review ditekan, pengguna akan dibawa ke halaman Review. Jika pengguna sudah memberikan review untuk order tersebut, tombol review akan hilang dari entri yang bersangkutan.
+##### *tombol detail hilang setelah memberikan review*
+![](assets/preview/history2.jpg)
 
-### Review
+### **Review**
 
-![](mocks/review.png)
+![](assets/preview/review.jpg)
 
-Pada halaman ini, pengguna dapat memberikan review untuk buku yang dipesan berupa rating dan komentar. Review yang diberikan dari halaman ini akan muncul pada halaman Book-Detail dari buku yang di-review. Setelah selesai, user akan dibawa kembali ke halaman History.
+Pada halaman ini, pengguna dapat memberikan *review* untuk buku yang dipesan berupa rating dan komentar. *Review* yang diberikan pada halaman ini akan muncul pada halaman Detail Buku dari buku yang di-*review*. Setelah selesai, user akan dibawa kembali ke halaman History.
 
-**--Bonus--**
-Rating dibuat seperti contoh.
+##### *memberikan review untuk buku*
+![](assets/preview/review2.jpg)
 
-### Validasi
-
-Validasi **wajib** dilakukan pada *client-side*, dengan menggunakan **javascript** bukan HTML 5 input type, yaitu:
-- Setiap field pada form tidak boleh kosong. 
-- Email harus sesuai format email.
-- Jumlah buku yang dipesan minimal 1.
-- Rating buku hanya boleh bernilai 1-5.
-- Nama pengguna maksimal 20 karakter.
-- Nomor telepon pengguna minimal 9 digit dan maksimal 12 digit.
-
-## Knowledge
-
-Untuk meringankan beban tugas ini, ada berberapa keyword yang bisa anda cari untuk menyelesaikan tugas ini.
-- HTTP methods: get, post, put, delete
-- CSS: margin, padding, header tag, font-size, text-align, float, clear, border, color, div, span, placeholder, anchor tag.
-- Javascript : XMLHTTPRequest, alert.
-- PHP: mysqli_connect, mysql_query, $_GET, $_POST, $_COOKIE, var_dump, print_r, echo, require, fungsi header.
-- SQL query: SELECT, INSERT, UPDATE, DELETE, WHERE, operator LIKE.
-Jika ada pertanyaan silakan tanyakan lewat milis.
 
 ### Pembagian Tugas
-*Setiap anggota kelompok diwajibkan untuk mengerjakan bagian tampilan dan fungsionalitas.*
 
 **Tampilan**
-1. Login : 1351xxxx, 135xxxxx
-2. Register : 135xxxxx
-3. Lanjutkan ...
+1. Login : 135116048
+2. Register : 13516048
+3. Search : 13516087
+4. Hasil Search : 13516087
+5. History : 13516039
+6. Review : 13516039
+7. Detail Buku : 13516087
+8. Profile : 13516156
+9. Edit Profile : 13516156
+10. Navigation Bar : 13516039
 
 **Fungsionalitas**
-1. Login : 135xxxxx, 135xxxxx
-2. Register : 135xxxxx
-3. Fungsionalitas : 135xxxxx,135xxxxx
-4. Lanjutkan...
+1. Login : 135116048
+2. Register : 13516048
+3. Search Buku : 13516087
+4. Order Buku : 13516087
+5. Show History : 13516039
+6. Show Review : 13516039
+7. Show Detail Buku : 13516087
+8. Show Profile : 13516156
+9. Edit Profile : 13516156
 
 ## About
 
-Asisten IF3110 2018
-
-Audry | Erick | Holy | Kevin J. | Tasya | Veren | Vincent H.
+Kelompok JLAS Tugas Besar 1 IF3110 Pengembangan Aplikasi Berbasis Web 2018
 
 Dosen : Yudistira Dwi Wardhana | Riza Satria Perdana | Muhammad Zuhri Catur Candra
-
diff --git a/assets/preview/detail.jpg b/assets/preview/detail.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..c938c51afb5c107d3d29772752c2a2490f363d30
Binary files /dev/null and b/assets/preview/detail.jpg differ
diff --git a/assets/preview/edit_profile.jpg b/assets/preview/edit_profile.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..4e60c748ff898d95e9393e577dbd703605368ca7
Binary files /dev/null and b/assets/preview/edit_profile.jpg differ
diff --git a/assets/preview/error_login.jpg b/assets/preview/error_login.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..52a0000f3577f9481ed47b6734b11610213db558
Binary files /dev/null and b/assets/preview/error_login.jpg differ
diff --git a/assets/preview/history.jpg b/assets/preview/history.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..ba1d8d562402665ba788899eff7bf6233336a3d3
Binary files /dev/null and b/assets/preview/history.jpg differ
diff --git a/assets/preview/history2.jpg b/assets/preview/history2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..4ae9f5f5fbb006f45a09f9d1b89dff9620c96991
Binary files /dev/null and b/assets/preview/history2.jpg differ
diff --git a/assets/preview/login.jpg b/assets/preview/login.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..a2372479bc3f570f73c8f4a501ff74bd5b12352b
Binary files /dev/null and b/assets/preview/login.jpg differ
diff --git a/assets/preview/notification.jpg b/assets/preview/notification.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..29becedfd37504b4caba4860e1ab7bbf169c1b36
Binary files /dev/null and b/assets/preview/notification.jpg differ
diff --git a/assets/preview/profile.jpg b/assets/preview/profile.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..a9682637f2b6fc23c3cfe47eee509b8e26c03fb8
Binary files /dev/null and b/assets/preview/profile.jpg differ
diff --git a/assets/preview/register.jpg b/assets/preview/register.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..8a5b12bda228274c260dec43f60c5520e6c9aa76
Binary files /dev/null and b/assets/preview/register.jpg differ
diff --git a/assets/preview/review.jpg b/assets/preview/review.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..027ebf8ee9075887594da82040fef68c8099c798
Binary files /dev/null and b/assets/preview/review.jpg differ
diff --git a/assets/preview/review2.jpg b/assets/preview/review2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..aaeb2f6d21c50b9d8f2441afec856cad11ecf8a7
Binary files /dev/null and b/assets/preview/review2.jpg differ
diff --git a/assets/preview/search.jpg b/assets/preview/search.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..62e7ab790a4058065d5f10b42490bf2ce4ccb372
Binary files /dev/null and b/assets/preview/search.jpg differ
diff --git a/assets/preview/search_result.jpg b/assets/preview/search_result.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..c7a403f7cb6614530ac5bfbb0baf649d73c00049
Binary files /dev/null and b/assets/preview/search_result.jpg differ
diff --git a/controller/Account/CheckUsernameController.php b/controller/Account/CheckUsernameController.php
index 96692f8acd848c41b88815b8aed07d5633a5aa9e..88180510884939be729feaa00b6ca0f3d19a3402 100644
--- a/controller/Account/CheckUsernameController.php
+++ b/controller/Account/CheckUsernameController.php
@@ -1,39 +1,39 @@
-<?php
-namespace JLAS\Book\Controller\Account;
-use \JLAS\Book\Controller\BaseController;
-use \JLAS\Book\Model as Model;
-use \JLAS\Book\Entity as Entity;
-
-class CheckUsernameController extends BaseController {
-
-    /**
-     * Get the data needed for this controller.
-     * @return array data passed to the view.
-     */
-    protected function run($params) {
-        if ($this->useArgs('username')) {
-            $valid = Entity\AccountEntity::isUsernameValid($this->getArg('username'));
-            if (!$valid['valid']) {
-                $this->setResponse(200, $valid['message']);
-                return false;
-            }
-            $model_account = new Model\AccountModel();
-            $user = $model_account->findByID($this->getArg('username'));
-            if (isset($user)) {
-                // User already exists.
-                $this->setResponse(200, "Username {$this->getArg('username')} is not available.");
-                return false;
-            } else {
-                // User doesn't exists.
-                $this->setResponse(200);
-                return true;
-            }
-        } else {
-            $this->setResponse(400);
-            return false;
-        }
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Controller\Account;
+use \JLAS\Book\Controller\BaseController;
+use \JLAS\Book\Model as Model;
+use \JLAS\Book\Entity as Entity;
+
+class CheckUsernameController extends BaseController {
+
+    /**
+     * Get the data needed for this controller.
+     * @return array data passed to the view.
+     */
+    protected function run($params) {
+        if ($this->useArgs('username')) {
+            $valid = Entity\AccountEntity::isUsernameValid($this->getArg('username'));
+            if (!$valid['valid']) {
+                $this->setResponse(200, $valid['message']);
+                return false;
+            }
+            $model_account = new Model\AccountModel();
+            $user = $model_account->findByID($this->getArg('username'));
+            if (isset($user)) {
+                // User already exists.
+                $this->setResponse(200, "Username {$this->getArg('username')} is not available.");
+                return false;
+            } else {
+                // User doesn't exists.
+                $this->setResponse(200);
+                return true;
+            }
+        } else {
+            $this->setResponse(400);
+            return false;
+        }
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/controller/Account/LoginController.php b/controller/Account/LoginController.php
index eec0265cf0db5d57cf6244c65f6769db65c2729d..848c7e9c50c586539e278f4520a14687a5bb04a7 100644
--- a/controller/Account/LoginController.php
+++ b/controller/Account/LoginController.php
@@ -1,76 +1,76 @@
-<?php
-namespace JLAS\Book\Controller\Account;
-use \JLAS\Book\Controller\BaseController;
-use \JLAS\Book\Model as Model;
-use \JLAS\Book\Entity as Entity;
-
-class LoginController extends BaseController {
-
-    public static $TokenDuration = "1 days";
-    
-    /**
-     * Generate access token.
-     */
-    public static function generateAccessToken($username, $length = 20) {
-        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
-        $charactersLength = strlen($characters);
-        $randomString = '';
-        for ($i = 0; $i < $length; $i++) {
-            $randomString .= $characters[rand(0, $charactersLength - 1)];
-        }
-        return hash('md5', base64_encode($username . $randomString));
-    }
-
-    /**
-     * Get the data needed for this controller.
-     * @return array data passed to the view.
-     */
-    protected function run($params) {
-        if ($this->useArgs('username', 'password')) {
-            $model_account = new Model\AccountModel();
-            $model_token = new Model\TokenModel();  
-            $user = $model_account->findByID($this->getArg('username'));
-            $token = $model_token->findByID($this->getArg('username'));
-            if (isset($this->token, $token)) {
-                // Test if the access-token is valid.
-                if ($token->validate($this->token)) {
-                    $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
-                    $model_token->update($token);
-                    $this->setResponse(200, "Already logged in");
-                    return $token->asArray();
-                }
-            }
-            if (isset($user)) {
-                if ($user->password === $this->getArg('password')) {
-                    $this->setResponse(200, "Logged in");
-                    // Do logging in.
-                    if (isset($token)) {
-                        // Update current token.
-                        $token->token = LoginController::generateAccessToken($user->username);
-                        $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
-                        $model_token->update($token);
-                    } else {
-                        // Create a new token.
-                        $token = new Entity\TokenEntity(array(
-                            "username" => $user->username,
-                            "access-token" => LoginController::generateAccessToken($user->username),
-                            "expiry" => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration))
-                        ));
-                        $model_token->create($token);
-                    }
-                    return $token->asArray();
-                } else {
-                    $this->setResponse(401, "Invalid username/password.");
-                    return $this->getArg('username');
-                }
-            } else {
-                $this->setResponse(401, "Invalid username/password.");
-                return $this->getArg('username');
-            }
-        }
-        $this->setResponse(400);
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Controller\Account;
+use \JLAS\Book\Controller\BaseController;
+use \JLAS\Book\Model as Model;
+use \JLAS\Book\Entity as Entity;
+
+class LoginController extends BaseController {
+
+    public static $TokenDuration = "1 days";
+    
+    /**
+     * Generate access token.
+     */
+    public static function generateAccessToken($username, $length = 20) {
+        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+        $charactersLength = strlen($characters);
+        $randomString = '';
+        for ($i = 0; $i < $length; $i++) {
+            $randomString .= $characters[rand(0, $charactersLength - 1)];
+        }
+        return hash('md5', base64_encode($username . $randomString));
+    }
+
+    /**
+     * Get the data needed for this controller.
+     * @return array data passed to the view.
+     */
+    protected function run($params) {
+        if ($this->useArgs('username', 'password')) {
+            $model_account = new Model\AccountModel();
+            $model_token = new Model\TokenModel();  
+            $user = $model_account->findByID($this->getArg('username'));
+            $token = $model_token->findByID($this->getArg('username'));
+            if (isset($this->token, $token)) {
+                // Test if the access-token is valid.
+                if ($token->validate($this->token)) {
+                    $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
+                    $model_token->update($token);
+                    $this->setResponse(200, "Already logged in");
+                    return $token->asArray();
+                }
+            }
+            if (isset($user)) {
+                if ($user->password === $this->getArg('password')) {
+                    $this->setResponse(200, "Logged in");
+                    // Do logging in.
+                    if (isset($token)) {
+                        // Update current token.
+                        $token->token = LoginController::generateAccessToken($user->username);
+                        $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
+                        $model_token->update($token);
+                    } else {
+                        // Create a new token.
+                        $token = new Entity\TokenEntity(array(
+                            "username" => $user->username,
+                            "access-token" => LoginController::generateAccessToken($user->username),
+                            "expiry" => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration))
+                        ));
+                        $model_token->create($token);
+                    }
+                    return $token->asArray();
+                } else {
+                    $this->setResponse(401, "Invalid username/password.");
+                    return $this->getArg('username');
+                }
+            } else {
+                $this->setResponse(401, "Invalid username/password.");
+                return $this->getArg('username');
+            }
+        }
+        $this->setResponse(400);
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/controller/Account/RegisterController.php b/controller/Account/RegisterController.php
index a485639870cac6dc400ba700fb2e1f8baa16bbc6..da6f83ab0a68dd8e2a08672f894303dce1c8193e 100644
--- a/controller/Account/RegisterController.php
+++ b/controller/Account/RegisterController.php
@@ -1,72 +1,72 @@
-<?php
-namespace JLAS\Book\Controller\Account;
-use \JLAS\Book\Controller\BaseController;
-use \JLAS\Book\Model as Model;
-use \JLAS\Book\Entity as Entity;
-
-class RegisterController extends BaseController {
-
-    /**
-     * Get the data needed for this controller.
-     * @return array data passed to the view.
-     */
-    protected function run($params) {
-        if ($this->useArgs('username', 'password', 'name', 'email', 'address', 'phone')) {
-            $model_account = new Model\AccountModel();
-            $model_biodata = new Model\BiodataModel();
-            $user = $model_account->findByID($this->getArg('username'));
-            $biodata = $model_biodata->where()->field('email')->equals($this->getArg('email'))->finish();
-            if (isset($user)) {
-                // User already exists.
-                $this->setResponse(700, "Username {$this->getArg('username')} already exists");
-                return;
-            } else {
-                $biodata = new Entity\GenericEntity(array(
-                    "username" => $this->getArg('username'),
-                    "name" => $this->getArg('name'),
-                    "email" => $this->getArg('email'),
-                    "address" => $this->getArg('address'),
-                    "phone" => $this->getArg('phone'),
-                ));
-                try {
-                    // Create user.
-                    $user = new Entity\AccountEntity(array(
-                        "username" => $this->getArg('username'),
-                        "password" => $this->getArg('password')
-                    ));
-                } catch (Entity\InvalidValueException $e) {
-                    $this->setResponse(400, $e->getMessage());
-                    return;
-                }
-                $model_account->create($user);
-                $model_biodata->create($biodata);
-
-                $model_token = new Model\TokenModel();
-                $token = $model_token->findByID($this->getArg('username'));
-                
-                if (isset($token)) {
-                    // Update current token.
-                    $token->token = LoginController::generateAccessToken($user->username);
-                    $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
-                    $model_token->update($token);
-                } else {
-                    // Create a new token.
-                    $token = new Entity\TokenEntity(array(
-                        "username" => $user->username,
-                        "access-token" => LoginController::generateAccessToken($user->username),
-                        "expiry" => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration))
-                    ));
-                    $model_token->create($token);
-                }
-                $this->setResponse(200, "User {$this->getArg('username')} created");
-                return $token->asArray();
-            }
-        } else {
-            $this->setResponse(400);
-            return;
-        }
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Controller\Account;
+use \JLAS\Book\Controller\BaseController;
+use \JLAS\Book\Model as Model;
+use \JLAS\Book\Entity as Entity;
+
+class RegisterController extends BaseController {
+
+    /**
+     * Get the data needed for this controller.
+     * @return array data passed to the view.
+     */
+    protected function run($params) {
+        if ($this->useArgs('username', 'password', 'name', 'email', 'address', 'phone')) {
+            $model_account = new Model\AccountModel();
+            $model_biodata = new Model\BiodataModel();
+            $user = $model_account->findByID($this->getArg('username'));
+            $biodata = $model_biodata->where()->field('email')->equals($this->getArg('email'))->finish();
+            if (isset($user)) {
+                // User already exists.
+                $this->setResponse(700, "Username {$this->getArg('username')} already exists");
+                return;
+            } else {
+                $biodata = new Entity\GenericEntity(array(
+                    "username" => $this->getArg('username'),
+                    "name" => $this->getArg('name'),
+                    "email" => $this->getArg('email'),
+                    "address" => $this->getArg('address'),
+                    "phone" => $this->getArg('phone'),
+                ));
+                try {
+                    // Create user.
+                    $user = new Entity\AccountEntity(array(
+                        "username" => $this->getArg('username'),
+                        "password" => $this->getArg('password')
+                    ));
+                } catch (Entity\InvalidValueException $e) {
+                    $this->setResponse(400, $e->getMessage());
+                    return;
+                }
+                $model_account->create($user);
+                $model_biodata->create($biodata);
+
+                $model_token = new Model\TokenModel();
+                $token = $model_token->findByID($this->getArg('username'));
+                
+                if (isset($token)) {
+                    // Update current token.
+                    $token->token = LoginController::generateAccessToken($user->username);
+                    $token->expiry = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration));
+                    $model_token->update($token);
+                } else {
+                    // Create a new token.
+                    $token = new Entity\TokenEntity(array(
+                        "username" => $user->username,
+                        "access-token" => LoginController::generateAccessToken($user->username),
+                        "expiry" => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . LoginController::$TokenDuration))
+                    ));
+                    $model_token->create($token);
+                }
+                $this->setResponse(200, "User {$this->getArg('username')} created");
+                return $token->asArray();
+            }
+        } else {
+            $this->setResponse(400);
+            return;
+        }
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/controller/BaseController.php b/controller/BaseController.php
index 376807a26b4ae8ebf7421eef4a1356129639cef9..743e4e199678cc3b9e6f73ffe5548aa80c6cf54c 100644
--- a/controller/BaseController.php
+++ b/controller/BaseController.php
@@ -1,140 +1,140 @@
-<?php 
-namespace JLAS\Book\Controller;
-use JLAS\Book\Model as Model;
-
-abstract class BaseController {
-
-    protected $data;
-    /**
-     * Override response_code and response_message.
-     * Defaults at 200 OK
-     */
-    protected $response = array(
-        "code" => 200
-    );
-
-    private $authenticated = null;
-    private $username = null;
-
-    function __construct($views, $params=null) {
-        $this->params = $params;
-        if (isset($params, $params['cookie'], $params['cookie']['access-token'])) {
-            $this->token = $params['cookie']['access-token'];
-        } else {
-            $this->token = null;
-        }
-        $this->path = $this->params['path'];
-        $this->method = $this->params['method'];
-        $this->cookie = $this->params['cookie'];
-        $this->data = $this->run($params);
-        $this->loadView($views);
-    }
-
-    /**
-     * @return string the name of the currently logged in user if logged in; otherwise null.
-     */
-    protected function getUsername() {
-        if ($this->isAuthenticated()) {
-            return $this->username;
-        }
-        return null;
-    }
-
-    /**
-     * @return boolean true if the request is an authenticated one; otherwise false.
-     */
-    protected function isAuthenticated() {
-        if (isset($this->token)) {
-            if (isset($this->authenticated)) {
-                return $this->authenticated;
-            } else {
-                $model_token = new Model\TokenModel();
-                $token = $model_token->where()->field('access-token')->equals($this->token)->finish();
-                if (count($token) > 0) {
-                    $this->username = $token[0]->username;
-                    return $this->authenticated = $token[0]->validate($this->token);
-                } else {
-                    return $this->authenticated = false;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Set the response status of this controller.
-     * @param int $code the status code of the response.
-     * @param string $message message to pass along.
-     */
-    protected function setResponse($code, $message="") {
-        $this->response["code"] = $code;
-        if (!empty($message)) {
-            $this->response["message"] = $message;
-        }
-    } 
-
-    /**
-     * Array of views to be loaded with this controller.
-     * @param array $views array of path to view's file (.php).
-     */
-    protected function loadView($views) {
-        ob_start();
-        $data = $this->data;
-        $response = $this->response;
-        $names = explode('\\', get_class($this));
-        $controller = array_pop($names);
-        foreach ($views as $view) {
-            include $view;
-        }
-        $content = ob_get_contents();
-        ob_end_clean();
-        $this->content = $content;
-        return $this->content;
-    }
-
-    public function out() {
-        return $this->content;
-    }
-
-    /**
-     * Get the data needed for this controller.
-     * @return array data passed to the view.
-     */
-    protected abstract function run($params);
-    
-    /**
-     * Use a set of arguments.
-     * Arguments are passed via $params as 'data'.
-     * @return boolean true if all arguments exist; otherwise false.
-     */
-    protected function useArgs(...$names) {
-        $valid = true;
-        foreach ($names as $name) {
-            if (!$this->hasArg($name)) {
-                $valid = false;
-                $this->response["message"] = "Missing parameter $name";
-                break;
-            }
-        }
-        return $valid;
-    }
-
-    /**
-     * @param string $name the name of the argument.
-     * @return boolean true if the argument exists; otherwise false.
-     */
-    protected function hasArg($name) {
-        return isset($this->params, $this->params['data'],$this->params['data'][$name]);
-    }
-    
-    /**
-     * @param string $name the name of the argument.
-     * @return mixed the value of the argument.
-     */
-    protected function getArg($name) {
-        return $this->params['data'][$name];
-    }
-
-}
-
+<?php 
+namespace JLAS\Book\Controller;
+use JLAS\Book\Model as Model;
+
+abstract class BaseController {
+
+    protected $data;
+    /**
+     * Override response_code and response_message.
+     * Defaults at 200 OK
+     */
+    protected $response = array(
+        "code" => 200
+    );
+
+    private $authenticated = null;
+    private $username = null;
+
+    function __construct($views, $params=null) {
+        $this->params = $params;
+        if (isset($params, $params['cookie'], $params['cookie']['access-token'])) {
+            $this->token = $params['cookie']['access-token'];
+        } else {
+            $this->token = null;
+        }
+        $this->path = $this->params['path'];
+        $this->method = $this->params['method'];
+        $this->cookie = $this->params['cookie'];
+        $this->data = $this->run($params);
+        $this->loadView($views);
+    }
+
+    /**
+     * @return string the name of the currently logged in user if logged in; otherwise null.
+     */
+    protected function getUsername() {
+        if ($this->isAuthenticated()) {
+            return $this->username;
+        }
+        return null;
+    }
+
+    /**
+     * @return boolean true if the request is an authenticated one; otherwise false.
+     */
+    protected function isAuthenticated() {
+        if (isset($this->token)) {
+            if (isset($this->authenticated)) {
+                return $this->authenticated;
+            } else {
+                $model_token = new Model\TokenModel();
+                $token = $model_token->where()->field('access-token')->equals($this->token)->finish();
+                if (count($token) > 0) {
+                    $this->username = $token[0]->username;
+                    return $this->authenticated = $token[0]->validate($this->token);
+                } else {
+                    return $this->authenticated = false;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Set the response status of this controller.
+     * @param int $code the status code of the response.
+     * @param string $message message to pass along.
+     */
+    protected function setResponse($code, $message="") {
+        $this->response["code"] = $code;
+        if (!empty($message)) {
+            $this->response["message"] = $message;
+        }
+    } 
+
+    /**
+     * Array of views to be loaded with this controller.
+     * @param array $views array of path to view's file (.php).
+     */
+    protected function loadView($views) {
+        ob_start();
+        $data = $this->data;
+        $response = $this->response;
+        $names = explode('\\', get_class($this));
+        $controller = array_pop($names);
+        foreach ($views as $view) {
+            include $view;
+        }
+        $content = ob_get_contents();
+        ob_end_clean();
+        $this->content = $content;
+        return $this->content;
+    }
+
+    public function out() {
+        return $this->content;
+    }
+
+    /**
+     * Get the data needed for this controller.
+     * @return array data passed to the view.
+     */
+    protected abstract function run($params);
+    
+    /**
+     * Use a set of arguments.
+     * Arguments are passed via $params as 'data'.
+     * @return boolean true if all arguments exist; otherwise false.
+     */
+    protected function useArgs(...$names) {
+        $valid = true;
+        foreach ($names as $name) {
+            if (!$this->hasArg($name)) {
+                $valid = false;
+                $this->response["message"] = "Missing parameter $name";
+                break;
+            }
+        }
+        return $valid;
+    }
+
+    /**
+     * @param string $name the name of the argument.
+     * @return boolean true if the argument exists; otherwise false.
+     */
+    protected function hasArg($name) {
+        return isset($this->params, $this->params['data'],$this->params['data'][$name]);
+    }
+    
+    /**
+     * @param string $name the name of the argument.
+     * @return mixed the value of the argument.
+     */
+    protected function getArg($name) {
+        return $this->params['data'][$name];
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/controller/Image/GetImageController.php b/controller/Image/GetImageController.php
index a3d91261b09dcafe3984d4e30ff74ac666090a5c..41fecdbc97b0e4e8e7021e04550192b17fe1ec32 100644
--- a/controller/Image/GetImageController.php
+++ b/controller/Image/GetImageController.php
@@ -1,31 +1,31 @@
-<?php
-namespace JLAS\Book\Controller\Image;
-use \JLAS\Book\Controller\BaseController;
-use \JLAS\Book\Model as Model;
-use \JLAS\Book\Entity as Entity;
-
-class GetImageController extends BaseController {
-
-    /**
-     * Get the data needed for this controller.
-     * @return array data passed to the view.
-     */
-    protected function run($params) {
-        if ($this->useArgs('id')) {
-            $model_image = new Model\ImageModel();
-            $image = $model_image->findByID($this->getArg('id'));
-            if (isset($image)) {
-                $this->setResponse(200);
-                return $image->asArray();
-            } else {
-                $this->setResponse(400, "Invalid image id");
-                return null;
-            }
-        }
-        $this->setResponse(400);
-        return null;
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Controller\Image;
+use \JLAS\Book\Controller\BaseController;
+use \JLAS\Book\Model as Model;
+use \JLAS\Book\Entity as Entity;
+
+class GetImageController extends BaseController {
+
+    /**
+     * Get the data needed for this controller.
+     * @return array data passed to the view.
+     */
+    protected function run($params) {
+        if ($this->useArgs('id')) {
+            $model_image = new Model\ImageModel();
+            $image = $model_image->findByID($this->getArg('id'));
+            if (isset($image)) {
+                $this->setResponse(200);
+                return $image->asArray();
+            } else {
+                $this->setResponse(400, "Invalid image id");
+                return null;
+            }
+        }
+        $this->setResponse(400);
+        return null;
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/entity/AccountEntity.php b/entity/AccountEntity.php
index 8b91d9c3ba1975b890b957315710a5b052b70507..b13024ae6c428a96123da216846780e6cdf43950 100644
--- a/entity/AccountEntity.php
+++ b/entity/AccountEntity.php
@@ -1,57 +1,57 @@
-<?php
-namespace JLAS\Book\Entity;
-
-class AccountEntity extends BaseEntity {
-
-    /**
-     * Username of the account.
-     */
-    public $username;
-
-    /**
-     * Password of the account.
-     */
-    public $password;
-
-    /**
-     * Load this entity from an associative array.
-     * @param $data data in which the entity is loaded from.
-     */
-    public function load($data) {
-        $this->username = BaseEntity::get($data, "username", ['JLAS\\Book\\Entity\\AccountEntity', 'isUsernameValid']);
-        $this->password = BaseEntity::get($data, "password", ['JLAS\\Book\\Entity\\AccountEntity', 'isPasswordValid']);
-    }
-
-    /**
-     * Returns entity as associative array.
-     * @return array
-     */
-    public function asArray() {
-        return array(
-            "username" => $this->username,
-            "password" => $this->password
-        );
-    }
-
-    public static function isUsernameValid($username) {
-        if (strlen($username) < 5) {
-            return array("valid"=>false, "message"=>"Username length must be greater than or equal to 5.");
-        }
-        if (!preg_match('/^\w+$/', $username)) {
-            return array("valid"=>false, "message"=>"Invalid username {$username}.");
-        }
-        return array("valid"=>true);
-    }
-
-    public static function isPasswordValid($password) {
-        if (strlen($password) < 6) {
-            return array("valid"=>false, "message"=>"Password length must be a minimal of 6.");
-        }
-        if (!preg_match('/^\w+$/', $password)) {
-            return array("valid"=>false, "message"=>"Illegal character in password.");
-        }
-        return array("valid"=>true);
-    }
-}
-
+<?php
+namespace JLAS\Book\Entity;
+
+class AccountEntity extends BaseEntity {
+
+    /**
+     * Username of the account.
+     */
+    public $username;
+
+    /**
+     * Password of the account.
+     */
+    public $password;
+
+    /**
+     * Load this entity from an associative array.
+     * @param $data data in which the entity is loaded from.
+     */
+    public function load($data) {
+        $this->username = BaseEntity::get($data, "username", ['JLAS\\Book\\Entity\\AccountEntity', 'isUsernameValid']);
+        $this->password = BaseEntity::get($data, "password", ['JLAS\\Book\\Entity\\AccountEntity', 'isPasswordValid']);
+    }
+
+    /**
+     * Returns entity as associative array.
+     * @return array
+     */
+    public function asArray() {
+        return array(
+            "username" => $this->username,
+            "password" => $this->password
+        );
+    }
+
+    public static function isUsernameValid($username) {
+        if (strlen($username) < 5) {
+            return array("valid"=>false, "message"=>"Username length must be greater than or equal to 5.");
+        }
+        if (!preg_match('/^\w+$/', $username)) {
+            return array("valid"=>false, "message"=>"Invalid username {$username}.");
+        }
+        return array("valid"=>true);
+    }
+
+    public static function isPasswordValid($password) {
+        if (strlen($password) < 6) {
+            return array("valid"=>false, "message"=>"Password length must be a minimal of 6.");
+        }
+        if (!preg_match('/^\w+$/', $password)) {
+            return array("valid"=>false, "message"=>"Illegal character in password.");
+        }
+        return array("valid"=>true);
+    }
+}
+
 ?>
\ No newline at end of file
diff --git a/entity/BaseEntity.php b/entity/BaseEntity.php
index 7ddc1a7dc4704dab11c1a8d47b3324b9d7719552..d23ddbe804c937619bd57627f06fbd5621a2b6be 100644
--- a/entity/BaseEntity.php
+++ b/entity/BaseEntity.php
@@ -1,57 +1,57 @@
-<?php 
-namespace JLAS\Book\Entity;
-use Exception;
-use JsonSerializable;
-
-class MissingValueException extends Exception {}
-class InvalidValueException extends Exception {}
-
-abstract class BaseEntity implements JsonSerializable {
-
-    /**
-     * Create a base entity.
-     */
-    function __construct($data) {
-        $this->load($data);
-    }
-
-    /**
-     * Get a value from array with name.
-     * @param array $array array containing the values.
-     * @param string $name of the field.
-     */
-    protected static function get($array, $name, $validator=null) {
-        if (isset($array[$name])) {
-            if ($validator){
-                $valid = call_user_func_array($validator, array($array[$name]));
-                if (!$valid['valid']) {
-                    throw new InvalidValueException("Invalid value for $name");
-                }
-            }
-            return $array[$name];
-        }
-        throw new MissingValueException("Missing value for $name");
-    }
-
-    /**
-     * Load this entity from an associative array.
-     * @param $data data in which the entity is loaded from.
-     */
-    public abstract function load($data);
-
-    /**
-     * Returns entity as associative array.
-     * @return array
-     */
-    public abstract function asArray();
-
-    /**
-     * Serialize this object as json.
-     */
-    public function jsonSerialize() {
-        return $this->asArray();
-    }
-
-}
-
+<?php 
+namespace JLAS\Book\Entity;
+use Exception;
+use JsonSerializable;
+
+class MissingValueException extends Exception {}
+class InvalidValueException extends Exception {}
+
+abstract class BaseEntity implements JsonSerializable {
+
+    /**
+     * Create a base entity.
+     */
+    function __construct($data) {
+        $this->load($data);
+    }
+
+    /**
+     * Get a value from array with name.
+     * @param array $array array containing the values.
+     * @param string $name of the field.
+     */
+    protected static function get($array, $name, $validator=null) {
+        if (isset($array[$name])) {
+            if ($validator){
+                $valid = call_user_func_array($validator, array($array[$name]));
+                if (!$valid['valid']) {
+                    throw new InvalidValueException("Invalid value for $name");
+                }
+            }
+            return $array[$name];
+        }
+        throw new MissingValueException("Missing value for $name");
+    }
+
+    /**
+     * Load this entity from an associative array.
+     * @param $data data in which the entity is loaded from.
+     */
+    public abstract function load($data);
+
+    /**
+     * Returns entity as associative array.
+     * @return array
+     */
+    public abstract function asArray();
+
+    /**
+     * Serialize this object as json.
+     */
+    public function jsonSerialize() {
+        return $this->asArray();
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/entity/GenericEntity.php b/entity/GenericEntity.php
index 02cfbde777d20d1b1da27c7a7e4263811a838521..3ce8b1a9a3867387c53bf4d0f19b5384169d440c 100644
--- a/entity/GenericEntity.php
+++ b/entity/GenericEntity.php
@@ -1,57 +1,57 @@
-<?php
-namespace JLAS\Book\Entity;
-
-class GenericEntity extends BaseEntity {
-
-    private $data;
-
-    /**
-     * Load this entity from an associative array.
-     * @param $data data in which the entity is loaded from.
-     */
-    public function load($data) {
-        $this->data = $data;
-    }
-
-    /**
-     * Returns entity as associative array.
-     * @return array
-     */
-    public function asArray() {
-        return $this->data;
-    }
-
-    /**
-     * Overload the default get method.
-     */
-    public function __get($name) {
-        if (isset($this->data[$name])) {
-            return $this->data[$name];
-        }
-        return null;
-    }
-
-    /**
-     * Overload the default set method.
-     */
-    public function __set($name, $value) {
-        $this->data[$name] = $value;
-    }
-    
-    /**
-     * Overload the default isset method.
-     */
-    public function __isset($name) {
-        return isset($this->data[$name]);
-    }
-
-    /**
-     * Overload the default unset method.
-     */
-    public function __unset($name) {
-        unset($this->data[$name]);
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Entity;
+
+class GenericEntity extends BaseEntity {
+
+    private $data;
+
+    /**
+     * Load this entity from an associative array.
+     * @param $data data in which the entity is loaded from.
+     */
+    public function load($data) {
+        $this->data = $data;
+    }
+
+    /**
+     * Returns entity as associative array.
+     * @return array
+     */
+    public function asArray() {
+        return $this->data;
+    }
+
+    /**
+     * Overload the default get method.
+     */
+    public function __get($name) {
+        if (isset($this->data[$name])) {
+            return $this->data[$name];
+        }
+        return null;
+    }
+
+    /**
+     * Overload the default set method.
+     */
+    public function __set($name, $value) {
+        $this->data[$name] = $value;
+    }
+    
+    /**
+     * Overload the default isset method.
+     */
+    public function __isset($name) {
+        return isset($this->data[$name]);
+    }
+
+    /**
+     * Overload the default unset method.
+     */
+    public function __unset($name) {
+        unset($this->data[$name]);
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/entity/ImageEntity.php b/entity/ImageEntity.php
index 17138e50fb3e5f385b4d19fb128cf9de25b67c14..ec00953c871ab0cac9dd154a5992547baa46da30 100644
--- a/entity/ImageEntity.php
+++ b/entity/ImageEntity.php
@@ -1,44 +1,44 @@
-<?php
-namespace JLAS\Book\Entity;
-
-class ImageEntity extends BaseEntity {
-
-    /**
-     * ID of the image.
-     */
-    public $id;
-
-    /**
-     * Data of the image.
-     */
-    public $data;
-
-    /**
-     * Type of the image.
-     */
-    public $type;
-
-    /**
-     * Load this entity from an associative array.
-     * @param $data data in which the entity is loaded from.
-     */
-    public function load($data) {
-        $this->id = BaseEntity::get($data, "id");
-        $this->data = BaseEntity::get($data, "data");
-        $this->type = BaseEntity::get($data, "type");
-    }
-
-    /**
-     * Returns entity as associative array.
-     * @return array
-     */
-    public function asArray() {
-        return array(
-            "id" => $this->id,
-            "data" => $this->data,
-            "type" => $this->type,
-        );
-    }
-}
-
+<?php
+namespace JLAS\Book\Entity;
+
+class ImageEntity extends BaseEntity {
+
+    /**
+     * ID of the image.
+     */
+    public $id;
+
+    /**
+     * Data of the image.
+     */
+    public $data;
+
+    /**
+     * Type of the image.
+     */
+    public $type;
+
+    /**
+     * Load this entity from an associative array.
+     * @param $data data in which the entity is loaded from.
+     */
+    public function load($data) {
+        $this->id = BaseEntity::get($data, "id");
+        $this->data = BaseEntity::get($data, "data");
+        $this->type = BaseEntity::get($data, "type");
+    }
+
+    /**
+     * Returns entity as associative array.
+     * @return array
+     */
+    public function asArray() {
+        return array(
+            "id" => $this->id,
+            "data" => $this->data,
+            "type" => $this->type,
+        );
+    }
+}
+
 ?>
\ No newline at end of file
diff --git a/entity/TokenEntity.php b/entity/TokenEntity.php
index d120ff939ed5f85f117ad3dbd54e84eff9d3b81f..d94d765d9c3d1a670613ce74487fd8096f10be53 100644
--- a/entity/TokenEntity.php
+++ b/entity/TokenEntity.php
@@ -1,63 +1,63 @@
-<?php
-namespace JLAS\Book\Entity;
-
-class TokenEntity extends BaseEntity {
-
-    /**
-     * Username of the account.
-     */
-    public $username;
-
-    /**
-     * The access token.
-     */
-    public $token;
-
-    /**
-     * The expiry date of the token.
-     */
-    public $expiry;
-
-    /**
-     * Load this entity from an associative array.
-     * @param $data data in which the entity is loaded from.
-     */
-    public function load($data) {
-        $this->username = BaseEntity::get($data, "username");
-        $this->token = BaseEntity::get($data, "access-token");
-        $this->expiry = BaseEntity::get($data, "expiry");
-    }
-
-    /**
-     * Returns entity as associative array.
-     * @return array
-     */
-    public function asArray() {
-        return array(
-            "username" => $this->username,
-            "access-token" => $this->token,
-            "expiry" => $this->expiry,
-        );
-    }
-
-    /**
-     * @param $current_time (optional) set the current time dynamically.
-     * @return boolean true if the token is expired; otherwise false.
-     */
-    public function isExpired($current_time=null) {
-        if (!isset($current_time)) {
-            $current_time = time();
-        }
-        return $current_time > strtotime($this->expiry);
-    }
-
-    public function validate($access_token, $current_time=null) {
-        if ($this->isExpired($current_time)) {
-            return false;
-        }
-        return $this->token === $access_token;
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Entity;
+
+class TokenEntity extends BaseEntity {
+
+    /**
+     * Username of the account.
+     */
+    public $username;
+
+    /**
+     * The access token.
+     */
+    public $token;
+
+    /**
+     * The expiry date of the token.
+     */
+    public $expiry;
+
+    /**
+     * Load this entity from an associative array.
+     * @param $data data in which the entity is loaded from.
+     */
+    public function load($data) {
+        $this->username = BaseEntity::get($data, "username");
+        $this->token = BaseEntity::get($data, "access-token");
+        $this->expiry = BaseEntity::get($data, "expiry");
+    }
+
+    /**
+     * Returns entity as associative array.
+     * @return array
+     */
+    public function asArray() {
+        return array(
+            "username" => $this->username,
+            "access-token" => $this->token,
+            "expiry" => $this->expiry,
+        );
+    }
+
+    /**
+     * @param $current_time (optional) set the current time dynamically.
+     * @return boolean true if the token is expired; otherwise false.
+     */
+    public function isExpired($current_time=null) {
+        if (!isset($current_time)) {
+            $current_time = time();
+        }
+        return $current_time > strtotime($this->expiry);
+    }
+
+    public function validate($access_token, $current_time=null) {
+        if ($this->isExpired($current_time)) {
+            return false;
+        }
+        return $this->token === $access_token;
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 8a86cc2ba899435357924104796425794ebae502..3fa89521f2cdd1524e590800a3a1c3ccb8a2203a 100644
--- a/index.php
+++ b/index.php
@@ -1,14 +1,14 @@
-<?php
-namespace JLAS\Book;
-define('ROOT', __DIR__ . '/');
-define('ROUTING', __DIR__ . '/routing/');
-require_once "framework/su.php";
-
-// Load all routing.
-foreach (glob(ROUTING . "*.php") as $filename) {
-    include $filename;
-}
-
-\SuPHP\start();
-
+<?php
+namespace JLAS\Book;
+define('ROOT', __DIR__ . '/');
+define('ROUTING', __DIR__ . '/routing/');
+require_once "framework/su.php";
+
+// Load all routing.
+foreach (glob(ROUTING . "*.php") as $filename) {
+    include $filename;
+}
+
+\SuPHP\start();
+
 ?>
\ No newline at end of file
diff --git a/model/AccountModel.php b/model/AccountModel.php
index 998b2649fae1728555028c67c276459c143bc390..32b0a7aa451a84e6d3d80c254ae294acfcaa3692 100644
--- a/model/AccountModel.php
+++ b/model/AccountModel.php
@@ -1,91 +1,91 @@
-<?php
-namespace JLAS\Book\Model;
-
-class AccountModel extends BaseModel {
-
-    function __construct() {
-        parent::__construct("AccountEntity");
-        $this->table = "account";
-    }
-
-    /**
-     * Find an account with specific username.
-     * @param string $id The username of the account.
-     * @return AccountEntity the entity with matching id.
-     */
-    public function findByID($id) {
-        $result = $this->query("SELECT * FROM $this->table WHERE `username` = :id LIMIT 1", array(":id"=>$id));
-        if (count($this->queryResult) > 0) {
-            return $this->newEntity($this->queryResult[0]);
-        }
-        return null;
-    }
-    
-    /**
-     * Find an entity matching the criteria.
-     * @return array an array containing all matching entities.
-     */
-    public function find($criteria, $data) {
-        $result = $this->query("SELECT * FROM $this->table WHERE $criteria", $data);
-        $retval = array();
-        if ($result) {
-            foreach ($this->queryResult as $row) {
-                array_push($retval, $this->newEntity($row));
-            }
-        }
-        return $retval;
-    }
-
-    /**
-     * Insert a new entity into the database.
-     * @param AccountEntity $entity the entity to be created.
-     * @return boolean if the creation is successful.
-     */
-    public function create($entity) {
-        if ($this->findByID($entity->username) != null) {
-            return false;
-        }
-        $result = $this->query(
-            "INSERT INTO $this->table (`username`, `password`) VALUES (:username, :password)",
-            array(
-                ":username" => $entity->username,
-                ":password" => $entity->password,
-            )
-        );
-        return $result;
-    }
-
-    /**
-     * Update an entity in the database.
-     * @param AccountEntity $entity the entity to be updated.
-     * @return boolean if the update is successful.
-     */
-    public function update($entity) {
-        $result = $this->query(
-            "UPDATE $this->table SET `password`=:password WHERE `username`=:username",
-            array(
-                ":username" => $entity->username,
-                ":password" => $entity->password,
-            )
-        );
-        return $result;
-    }
-
-    /**
-     * Delete an entity from the database.
-     * @param AccountEntity $entity the entity to be deleted.
-     * @return boolean if the deletion is successful.
-     */
-    public function delete($entity) {
-        $result = $this->query(
-            "DELETE FROM $this->table WHERE `username`=:username",
-            array(
-                ":username" => $entity->username,
-            )
-        );
-        return $result;
-    }
-
-}
-
+<?php
+namespace JLAS\Book\Model;
+
+class AccountModel extends BaseModel {
+
+    function __construct() {
+        parent::__construct("AccountEntity");
+        $this->table = "account";
+    }
+
+    /**
+     * Find an account with specific username.
+     * @param string $id The username of the account.
+     * @return AccountEntity the entity with matching id.
+     */
+    public function findByID($id) {
+        $result = $this->query("SELECT * FROM $this->table WHERE `username` = :id LIMIT 1", array(":id"=>$id));
+        if (count($this->queryResult) > 0) {
+            return $this->newEntity($this->queryResult[0]);
+        }
+        return null;
+    }
+    
+    /**
+     * Find an entity matching the criteria.
+     * @return array an array containing all matching entities.
+     */
+    public function find($criteria, $data) {
+        $result = $this->query("SELECT * FROM $this->table WHERE $criteria", $data);
+        $retval = array();
+        if ($result) {
+            foreach ($this->queryResult as $row) {
+                array_push($retval, $this->newEntity($row));
+            }
+        }
+        return $retval;
+    }
+
+    /**
+     * Insert a new entity into the database.
+     * @param AccountEntity $entity the entity to be created.
+     * @return boolean if the creation is successful.
+     */
+    public function create($entity) {
+        if ($this->findByID($entity->username) != null) {
+            return false;
+        }
+        $result = $this->query(
+            "INSERT INTO $this->table (`username`, `password`) VALUES (:username, :password)",
+            array(
+                ":username" => $entity->username,
+                ":password" => $entity->password,
+            )
+        );
+        return $result;
+    }
+
+    /**
+     * Update an entity in the database.
+     * @param AccountEntity $entity the entity to be updated.
+     * @return boolean if the update is successful.
+     */
+    public function update($entity) {
+        $result = $this->query(
+            "UPDATE $this->table SET `password`=:password WHERE `username`=:username",
+            array(
+                ":username" => $entity->username,
+                ":password" => $entity->password,
+            )
+        );
+        return $result;
+    }
+
+    /**
+     * Delete an entity from the database.
+     * @param AccountEntity $entity the entity to be deleted.
+     * @return boolean if the deletion is successful.
+     */
+    public function delete($entity) {
+        $result = $this->query(
+            "DELETE FROM $this->table WHERE `username`=:username",
+            array(
+                ":username" => $entity->username,
+            )
+        );
+        return $result;
+    }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/view/json.php b/view/json.php
index f83cc00f87d04ee8e0a8c1d6515e84674730e72e..c8e16597fcf1d69e8c80be2d6de575a0ca7fdb97 100644
--- a/view/json.php
+++ b/view/json.php
@@ -1,11 +1,11 @@
-<?php
-$object = array(
-    "code" => $response['code'],
-    "data" => $data
-);
-if (isset($response['message'])) {
-    $object['message'] = $response['message'];
-}
-header("Content-Type: application/json");
-echo json_encode($object)
+<?php
+$object = array(
+    "code" => $response['code'],
+    "data" => $data
+);
+if (isset($response['message'])) {
+    $object['message'] = $response['message'];
+}
+header("Content-Type: application/json");
+echo json_encode($object)
 ?>
\ No newline at end of file
diff --git a/view/search.php b/view/search.php
index a22abf2b72779c4320669cc415713c485090755d..c4ea802c47e1c766b94b51a0c80d9c7e349a79e6 100644
--- a/view/search.php
+++ b/view/search.php
@@ -9,7 +9,6 @@
             include VIEW . "navBar.php";
             css("search.css");
             css("main.css");
-            js("detail.js");
         ?>
     </head>
     <body>