little remake of code structure