The flow pattern of blood in the heart is intimately connected with the performance of the heart valves. This paper extends previous work on the solution of the Navier-Stokes equations in the presence of moving immersed boundaries which interact with the fluid. The boundary representation now includes the muscular heart wall. The fixed topology of the boundary representation is exploited in the solution of the nonlinear equations which implicitly define the boundary forces. An improved numerical representation of the δ-function is introduced. A fast Laplace-solver is used. The results of calculations with a natural valve and with a prosthetic valve are presented.