Added applying matrix functions.