work in progress, make code more generic