src/shared: refactor shared code

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Merge pull request #96 from gentoo/refactor-shared

src/shared: refactor shared code