Remove unused code

All this code (committed as 267ab96cf926951b2e253cc8b5eb1854a006a91c) appears to be unused.
Remove duplicate code
wip
wip