clean up + factoring