first implementations for the second exercise, pretty gnarly though, not
really tested anything yet