OK, cleaned up the script a little fter that hackery