matrix class appears to work