Improve performances. Fix various bugs.