Refactor ploader into npm module