Bug Fix: Matlab 100% CPU Usage. Code Restructured as well for the same reason