add melt function

this fixes #177. Thanks @aaelony for initial version