initial version, messy no tests :(