cleaning up the script a bit