Update: Code refactoring