moved plotting into module
fixed bug in quality subsampling