added functionality and test for msg <k>