huge refactoring on metrics
added @NotNull and localized a bug. Will fix tomorrow.
rm debug output introduced while localizing a bug