Delete some dead and duplicated code