Added compile directive
Added state logging