Fixed correct message handling
Better use of API