New files ported from stackmate