refactoring all my code totall mess