Adds some refactoring

Addresses #JOINDIN-397