cleaned up script a bit