Refactor based on @trustin 's comments and so produce even less GC / mem usage