removing duplicate code.