Merged with remybourgoin's branch