rough complete code