Cleanup, still some bugs left