cp refactor & spec tests