Added methods to reduce code reuse

Added two instance methods to remove duplicated code.