changed from no nesting to max 3 levels
add nesting to declaration order