Cleanup and remove dead code