some refactoring, and a generalized method for fade calculations