Enabling compiler optimization and checks for all warnings.
Getting rid of redundant flag when opening the device.
Moving restoration of tty settings to close, calling it from dtor.
Some renaming and adding new logs.