extracting functions to libraries
plotting
left over changes
applying gmm