Additions

changed some of the logic in the code.