Code refactore