Added form drawing mechanism, hooks for optimization in examples