More bug fixes and polishing