remove code duplication in blocklistener