change algorithm to replace melted playlist

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
use "out" instead of "length"

Signed-off-by: Tomas Neme <lacrymology@gmail.com>