extracted receive functions to a static lib