first working version
working improved interface