before branchings, same code as original just normalized