Slight file refactoring and addition of plotting functions