some code improvments