Add validation and load_by_code