Got rid of code duplication as reported by @blackdrag