Remove some code duplication, add cert file path attributes