implemented matrix representation and feature extraction