binary tree structured program; push away side effects