Works, tested on linux only.
Needs some corrections.
