refactor message loading + tests