Updated to match current method of specifying actions.Also some cleanup.