script mostly done