changed Makefile, erased the other problems

extracted matrix into its own files, and fixed minor problems