working version, comments to be removed