modularized for browserifying