Fixes things and some script cleanup