implemented conditional commands so capabilities not supported by a tool aren't exposed. Added some comments, tidied some code.