add better tests and cleanup casting, add deflate methods