refactory: use struct to wrap common variables