added fault table and cleaned up code