Cleaned up script and tests