style changes and fixed a few bugs