Waiting for Vidal to fix several bugs in this file. Please do not merge yet!