full and hopefully correct formula