minor mods - still need polishing