Remove unused code and fix some specs