rewrite instructions for different functions