Added support of definitions inside optimize{}
optimize{} now detencts consequent Box&Unbox pairs and eliminates them
Refactored optimize{}