Fix implementation of request handling

Simple receiving and handling requests mechanism
seems to work properly. Need better
memory management.

Signed-off-by: Severus <pfpawelec@gmail.com>