major fix resolving declarations