Added source/target field configuration options. Cleaned up code.