refactors and adding appender code