Code refactoring/simplification