Added logic to code environments and databags