modify tedious code