Added method definitions and considered other cases