resolves #68 but we need to make the code more abstract