Bug fixes - ready for final testing