Compile with -fPIC and further refactoring