major rework, add classy implementation