Cleaned up script a bit