first crude version of the single pass gain finder
first crude version of the single pass gain finder
Revert "first crude version of the single pass gain finder"

This reverts commit 4ed9bd39547e5a2a86d894861e44b586d30b747e.
second crude version of the single pass gain finder
third crude version of the single pass gain finder
fourth crude version of the single pass gain finder
phew! finally made regression work
some general cleanup