moved string query generation logic to proper class + updated javadoc