Various improvements from Thierry + improved integer type