added comments and cleaned up matlab files