Some changes in structure and code