Bug fixes and some style updates based on carolyns feedback