Complete refactor to make it perform faster using addon sdk v1.14.