Major changes. Final version