refactor of raw_ functions