Small patches to your PR

@cctuan I've added small fix following the specs:
https://mozilla.box.com/s/wzgsb3lkqglv0dnfdgzs/1/991301651/8884791897/1
https://mozilla.box.com/s/wzgsb3lkqglv0dnfdgzs/1/991301651/8884794879/1

As you see there are a lot of changes, but this is only because the rebase.