Removed non used variable
Added ifdef for matrix to not load matrix more than one time