first altered working version