Lots of changes by gleb