#18 extract more functions