cleaning up for pure matlab implementation
initial import