modified to support multy schemas