Code structure improved