Generics galore

Signed-off-by: Matthias Stevens <matthias.stevens@gmail.com>