code update: first working version