Refactor

- Use of assignment of var self = this should be only used when needed.
- Moved empty array return to module scope instead of creation on every
  return.