some more code clearning and more testing