We present KETJU, a new regularized tree code based on algorithmic chain regularization and implemented into Gadget-3. This new code is able to follow simultaneously galactic-scale dynamical and astrophysical processes and the small-scale supermassive black hole binary dynamics. We present here the general idea of this new code and show a test simulation of black hole binary dynamics in a galaxy merger of two massive elliptical galaxies. The separation of the black holes at the time of the merger is several orders of magnitude smaller in KETJU than when compared to ordinary Gadget-3 simulations. The merger timescale is also longer by 100 - 200 Myr.