Minor improvements (refactoring)