Merged Leroy's code and general bug fixing