Extract shared code from handlers

Javadoc is missing and the variable name should be more fitting to the possible content