trying to make sh friendly
reworking global and dep functions