[WIP][issue #83] code modified and new function added