code refactored and repository reorganized