fixed a variety of memory errors
wrote simple gaussian elimination solver