Changed melt algorithm. Needs more work.