This is the final part of refactoring for EP1822 with various base functionality already added into develop.