general tidyup by removing dead code