A general approach to the problem of action-angle variables (new version)