extract and re-use