Modifications for windows matlab compatibility