Some clean-up, bugfixes. It is not work with structs and 3rd-party code must be updated.