Made more code reusable through a static libarry

As more tools are being added, more functionality will be shared across tools.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>