removed unused code

removed unused code
Various small fixes