Some bug fixed and source tree cleaned up