Refactor and add basic icp script