Revert "Refactor and small enhancements"

This reverts commit 06e149fc96852308622b66d8a614f6fff2de4938.