Some stability additions to the code