refactoring much code, changing name space