Improve code logic
last changements