A lot of changes. Many dirty. Will be fixed in next commit