some work and style changes