cleaned some stuff up. fixed NPE.