Preliminary script for whole problem