fixes sort order of messages
refactors application into better folder structure