some code refactores