added foreign field support
added params support
changed if statement to faster solution
Merge commit 'a5747b9f547fb89252d92483db2923c41a242c06' into develop