added algorithms to make pile and rack, and replace rack