Minor refactoring.

Refactoring to minimize code and enhance readability