Changes as per rail's review, https://bugzilla.mozilla.org/show_bug.cgi?id=772190#c39