mostly done, todo: bugtesting