added finddead target, removed dead code and made some functions