futher changes: added comments to functions