Some changes in code structure