Moving processing of custom buttons

This way, we can handle custom button actions before the data is
gathered, so modifications are reflected properly, etc.