reworked to use the main-loop package

Signed-off-by: Jan Dvořák <mordae@anilinux.org>