wip - cleaned code