Added discipline addition code, some fixes