Reorganized perl scripts