Changed filt keys to use constant variables instead of strings
fixed nan isse in weighted average