Modifications to debug and read properly from matlab