Code cleanup, removed matlab legacy code