Extract alignment code to separate methods.