diff --git a/.gitattributes b/.gitattributes
index 9fdc8f2baf767ebcca1a35dbf640ec347f65e14b..46011f6aa90f4e07151780a893fc9591d70730eb 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -14,6 +14,8 @@ appfw/configure.in -text
 appfw/src/Makefile.in -text
 appfw/src/Makefile.mac -text
 appfw/src/SConscript -text
+appfw/src/SConscript.32 -text
+appfw/src/SConscript.64 -text
 appfw/src/SConstruct -text
 appfw/src/appfw.cpp -text
 appfw/src/appfw.h -text
diff --git a/appfw/src/SConscript b/appfw/src/SConscript
index 2afc66d57e8158b698e5069a9683ca7fb7f3fdc7..75e1a903119ef705a4aff8e7e43f0ffb3deb655e 100644
--- a/appfw/src/SConscript
+++ b/appfw/src/SConscript
@@ -13,6 +13,7 @@ def substitute_in_file(file, search_pattern, replacement):
 
 Import('env')
 env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
+env.Replace(INSTALL_PATH_PREFIX="$SECURITY_TRANSFORMS_HOME/appfw/lib")
 
 if env['INSTALL_PATH_PREFIX'] is None:
     print 'Undefined INSTALL_PATH_PREFIX'
@@ -49,7 +50,11 @@ else:
     shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'appfw_sqlite3.h'))
 
     shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'sqlite3.h'))
-    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, '..', 'sqlite3.h'))
+# sqlite3.h gets removed b/c it's moved into build32
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
 
     # need to do the sed replacement:  sqlite3.[ch] --> appfw_sqlite3.[ch]
     substitute_in_file(os.path.join(target_dir,'appfw_sqlite3.c'), 'sqlite3', 'appfw_sqlite3')
@@ -62,10 +67,12 @@ else:
        for line in fileinput.input(files=('appfw_sqlite3.c', sqlfw_c)):
            fout.write(line)
 
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
+
 libname="appfw"
 
 files_c = '''
-    combined_sqlite3.c
     appfw_ldap.c
     openldap_hook.c
     mysql_hook.c
@@ -75,30 +82,31 @@ files_c = '''
     hooker.c
     oscfw.c
     xqfw.c
+    combined_sqlite3.c
     '''
 
 files_cpp = '''
-    appfw.cpp
     osc_parse.cpp
     sql_structure.cpp
     xq_hook.cpp
     xq_parser.cpp
+    appfw.cpp
     '''
 
-cpppath=''' 
-	.
+cpppath = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src')
+cpppath += ''' 
 	/usr/include/postgresql
 	/usr/include/mysql
 	/usr/include/libxml2
 	/usr/include/x86_64-linux-gnu
 	'''
 
+
 CFLAGS=" -fPIC -Wall -W -Wextra -Wconversion "
 CFLAGS+=" -DSQLITE_OS_UNIX=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEBUG=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_4_BYTE_ALIGNED_MALLOC " 
 CFLAGS+=" -DXQILLA_MAJOR_VER=2 -DXQILLA_MINOR_VER=9 "
 
 env=env.Clone(CPPPATH=Split(cpppath))
-#env.Append(CFLAGS=CFLAGS)
 env.Append(CCFLAGS=CFLAGS)
 env.Append(LINKFLAGS=env['CFLAGS'])
 
diff --git a/appfw/src/SConscript.32 b/appfw/src/SConscript.32
new file mode 100644
index 0000000000000000000000000000000000000000..bf7725f5556c47531c587685e4277bce047a5e8c
--- /dev/null
+++ b/appfw/src/SConscript.32
@@ -0,0 +1,118 @@
+import os
+import tarfile
+import shutil
+import re
+import fileinput
+
+def substitute_in_file(file, search_pattern, replacement):
+    with open(file, "r") as source:
+        lines = source.readlines()
+    with open(file, "w") as source:
+        for line in lines:
+            source.write(re.sub(search_pattern, replacement, line))
+
+Import('env')
+
+env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
+env.Replace(INSTALL_PATH_PREFIX="$SECURITY_TRANSFORMS_HOME/appfw/lib/32")
+env.Replace(CFLAGS="-m32")
+env.Replace(CCFLAGS="-m32")
+
+SQLITE3_DIR=os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'third_party/SQLITE3')
+
+print 'i am in cwd: ', os.getcwd()
+
+if env.GetOption('clean'):
+    print 'option clean is turned on'
+    if os.path.exists(SQLITE3_DIR):
+        shutil.rmtree(SQLITE3_DIR)
+    if os.path.exists('appfw_sqlite3.c'):
+        os.remove('appfw_sqlite3.c')
+    if os.path.exists('appfw_sqlite3.h'):
+        os.remove('appfw_sqlite3.h')
+    if os.path.exists('combined_sqlite3.c'):
+        os.remove('combined_sqlite3.c')
+else:
+    if not os.path.exists(SQLITE3_DIR):
+        os.makedirs(SQLITE3_DIR)     # make directory 
+        tgz=tarfile.open(os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'third_party/sqlite-autoconf-3071300.tar.gz'), "r:gz")
+        print 'Extracting needed files from sqlite3 tarball'
+        tgz.list(verbose=False)
+        tgz.extract('sqlite-autoconf-3071300/sqlite3.h', SQLITE3_DIR)
+        tgz.extract('sqlite-autoconf-3071300/sqlite3.c', SQLITE3_DIR)
+
+    assert os.path.isdir(SQLITE3_DIR)
+
+    source_dir = os.path.join(SQLITE3_DIR, 'sqlite-autoconf-3071300') 
+    target_dir = os.getcwd()
+    shutil.copy(os.path.join(source_dir, 'sqlite3.c'), os.path.join(target_dir, 'appfw_sqlite3.c'))
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'appfw_sqlite3.h'))
+
+    print 'Copying sqlite3.h into: ' + os.path.join(target_dir, 'sqlite3.h')
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'sqlite3.h'))
+    print 'Copying sqlite3.h into: ' + os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h'))
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
+
+    # need to do the sed replacement:  sqlite3.[ch] --> appfw_sqlite3.[ch]
+    substitute_in_file(os.path.join(target_dir,'appfw_sqlite3.c'), 'sqlite3', 'appfw_sqlite3')
+    substitute_in_file(os.path.join(target_dir,'appfw_sqlite3.h'), 'sqlite3', 'appfw_sqlite3')
+
+    sqlfw_c = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src', 'sqlfw.c')
+    combined_sqlite3_c = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src', 'combined_sqlite3.c')
+
+    with open(combined_sqlite3_c, 'w') as fout:
+       for line in fileinput.input(files=('appfw_sqlite3.c', sqlfw_c)):
+           fout.write(line)
+
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
+
+libname="appfw"
+
+files_c = '''
+    appfw_ldap.c
+    openldap_hook.c
+    mysql_hook.c
+    sqlite3_hook.c
+    osc_hook.c
+    pg_hook.c
+    hooker.c
+    oscfw.c
+    xqfw.c
+    combined_sqlite3.c
+    '''
+
+files_cpp = '''
+    osc_parse.cpp
+    sql_structure.cpp
+    xq_hook.cpp
+    xq_parser.cpp
+    appfw.cpp
+    '''
+
+cpppath = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src')
+cpppath += ''' 
+	/usr/include/postgresql
+	/usr/include/mysql
+	/usr/include/libxml2
+	/usr/include/x86_64-linux-gnu
+	'''
+
+CFLAGS=" -fPIC -Wall -W -Wextra -Wconversion "
+CFLAGS+=" -DSQLITE_OS_UNIX=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEBUG=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_4_BYTE_ALIGNED_MALLOC " 
+CFLAGS+=" -DXQILLA_MAJOR_VER=2 -DXQILLA_MINOR_VER=9 "
+
+env=env.Clone(CPPPATH=Split(cpppath))
+env.Append(CCFLAGS=CFLAGS)
+env.Append(LINKFLAGS=env['CFLAGS'])
+env.Append(SHLINKFLAGS=" -m32 -ldl -shared ")
+
+lib=env.SharedLibrary(libname, Split(files_c + files_cpp))
+
+install=env.Install("$INSTALL_PATH_PREFIX", lib)
+
+Default(install)
+
diff --git a/appfw/src/SConscript.64 b/appfw/src/SConscript.64
new file mode 100644
index 0000000000000000000000000000000000000000..989a0e11fb9532455bf649a8096492205d20e714
--- /dev/null
+++ b/appfw/src/SConscript.64
@@ -0,0 +1,118 @@
+import os
+import tarfile
+import shutil
+import re
+import fileinput
+
+def substitute_in_file(file, search_pattern, replacement):
+    with open(file, "r") as source:
+        lines = source.readlines()
+    with open(file, "w") as source:
+        for line in lines:
+            source.write(re.sub(search_pattern, replacement, line))
+
+Import('env')
+
+env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
+env.Replace(CFLAGS="-m64")
+env.Replace(CCFLAGS="-m64")
+env.Replace(INSTALL_PATH_PREFIX="$SECURITY_TRANSFORMS_HOME/appfw/lib/64")
+
+SQLITE3_DIR=os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'third_party/SQLITE3')
+
+print 'i am in cwd: ', os.getcwd()
+
+if env.GetOption('clean'):
+    print 'option clean is turned on'
+    if os.path.exists(SQLITE3_DIR):
+        shutil.rmtree(SQLITE3_DIR)
+    if os.path.exists('appfw_sqlite3.c'):
+        os.remove('appfw_sqlite3.c')
+    if os.path.exists('appfw_sqlite3.h'):
+        os.remove('appfw_sqlite3.h')
+    if os.path.exists('combined_sqlite3.c'):
+        os.remove('combined_sqlite3.c')
+else:
+    if not os.path.exists(SQLITE3_DIR):
+        os.makedirs(SQLITE3_DIR)     # make directory 
+        tgz=tarfile.open(os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'third_party/sqlite-autoconf-3071300.tar.gz'), "r:gz")
+        print 'Extracting needed files from sqlite3 tarball'
+        tgz.list(verbose=False)
+        tgz.extract('sqlite-autoconf-3071300/sqlite3.h', SQLITE3_DIR)
+        tgz.extract('sqlite-autoconf-3071300/sqlite3.c', SQLITE3_DIR)
+
+    assert os.path.isdir(SQLITE3_DIR)
+
+    source_dir = os.path.join(SQLITE3_DIR, 'sqlite-autoconf-3071300') 
+    target_dir = os.getcwd()
+    shutil.copy(os.path.join(source_dir, 'sqlite3.c'), os.path.join(target_dir, 'appfw_sqlite3.c'))
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'appfw_sqlite3.h'))
+
+    print 'Copying sqlite3.h into: ' + os.path.join(target_dir, 'sqlite3.h')
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.join(target_dir, 'sqlite3.h'))
+    print 'Copying sqlite3.h into: ' + os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h'))
+    shutil.copy(os.path.join(source_dir, 'sqlite3.h'), os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
+
+    # need to do the sed replacement:  sqlite3.[ch] --> appfw_sqlite3.[ch]
+    substitute_in_file(os.path.join(target_dir,'appfw_sqlite3.c'), 'sqlite3', 'appfw_sqlite3')
+    substitute_in_file(os.path.join(target_dir,'appfw_sqlite3.h'), 'sqlite3', 'appfw_sqlite3')
+
+    sqlfw_c = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src', 'sqlfw.c')
+    combined_sqlite3_c = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src', 'combined_sqlite3.c')
+
+    with open(combined_sqlite3_c, 'w') as fout:
+       for line in fileinput.input(files=('appfw_sqlite3.c', sqlfw_c)):
+           fout.write(line)
+
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, '..', 'sqlite3.h')))
+    assert os.path.exists(os.path.abspath(os.path.join(target_dir, 'sqlite3.h')))
+
+libname="appfw"
+
+files_c = '''
+    appfw_ldap.c
+    openldap_hook.c
+    mysql_hook.c
+    sqlite3_hook.c
+    osc_hook.c
+    pg_hook.c
+    hooker.c
+    oscfw.c
+    xqfw.c
+    combined_sqlite3.c
+    '''
+
+files_cpp = '''
+    osc_parse.cpp
+    sql_structure.cpp
+    xq_hook.cpp
+    xq_parser.cpp
+    appfw.cpp
+    '''
+
+cpppath = os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'], 'appfw', 'src')
+cpppath += ''' 
+	/usr/include/postgresql
+	/usr/include/mysql
+	/usr/include/libxml2
+	/usr/include/x86_64-linux-gnu
+	'''
+
+
+CFLAGS=" -fPIC -Wall -W -Wextra -Wconversion "
+CFLAGS+=" -DSQLITE_OS_UNIX=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEBUG=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_4_BYTE_ALIGNED_MALLOC " 
+CFLAGS+=" -DXQILLA_MAJOR_VER=2 -DXQILLA_MINOR_VER=9 "
+
+env=env.Clone(CPPPATH=Split(cpppath))
+env.Append(CCFLAGS=CFLAGS)
+env.Append(LINKFLAGS=env['CFLAGS'])
+
+lib=env.SharedLibrary(libname, Split(files_c + files_cpp))
+
+install=env.Install("$INSTALL_PATH_PREFIX", lib)
+
+Default(install)
+
diff --git a/appfw/src/SConstruct b/appfw/src/SConstruct
index 4d00f48b8885cd72c7c81da9d80c95f115620c1d..942b7156764d1b9b334c8ca056197078ce372822 100644
--- a/appfw/src/SConstruct
+++ b/appfw/src/SConstruct
@@ -4,9 +4,9 @@ Export('env')
 env.Replace(CFLAGS="-m64")
 env.Replace(CCFLAGS="-m64")
 env.Replace(INSTALL_PATH_PREFIX="$SECURITY_TRANSFORMS_HOME/appfw/lib/64")
-SConscript("SConscript", variant_dir='build64')
+SConscript("SConscript.64", variant_dir='build64')
 
 env.Replace(CFLAGS="-m32")
 env.Replace(CCFLAGS="-m32")
 env.Replace(INSTALL_PATH_PREFIX="$SECURITY_TRANSFORMS_HOME/appfw/lib/32")
-SConscript("SConscript", variant_dir='build32')
+SConscript("SConscript.32", variant_dir='build32')