initial packaging
fixed empty messages handling and unused var