Squashed commit of the following:

commit 64de6f83f90753570cd87e14cdde032c6884fa8d
Author: Man Vuong <thanhman.gm@gmail.com>
Date:   Tue Oct 7 16:54:21 2014 +0700

    Revise code

commit e7fa6d086c089be82df96890e126bff159e17e6d
Author: Man Vuong <thanhman.gm@gmail.com>
Date:   Tue Oct 7 16:42:25 2014 +0700

    Fix problem of generating wrong path, e.g https://demo.firebaseio.comusers
reimplement #11 and add a test for that