cleanup
refactored session and message stuff