refactor and modularise message view