removed unused code in both scripts