Added guard conditions for two-way binding