first semi working version