Code refactoring

Should not affect functionality.