code structure reorganised