code-cleanup

Refactor and clean up code following best practices for readability and maintainability