Remove untested and unused code

Closes #1639