Fixed isValid method and added way to set data