Remove some warnings
Use automatic resource management
Update libraries