Logic added to directive