add writemime output
remove some utility methods