restructured code into lib parts

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
add cleanup option

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
1.2.0

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>