initial working version, tested on ubuntu.