Use common code and constants from services.inc

Reduce code duplication