cleaned up the matlab code a bit