slightly altered makedist process