adding modularization of code and start of linear algebra functions