Code modified for compatibility with ulavalSFM