[MAIN] Code refactoring