removed CIS, tidied code