Remove dead code
Refactor into separate modules