refactored, packet <=> message conversion feature implemented